简体   繁体   English

在包含statsmodels的.py文件上使用PyInstaller(控制台,onefile)

[英]Using PyInstaller (console, onefile) on a .py file that includes statsmodels

When I run the .exe , it generates the following in the console output: 当我运行.exe ,它将在控制台输出中生成以下内容:

C:\\Python27\\Scripts\\dist>SNAPpy279.exe

Traceback (most recent call last): File "<string>", line 26, in <module> File "C:\\Python27\\Lib\\site-packages\\PyInstaller\\loader\\pyi_importers.py", line 270, in load_module exec(bytecode, module.__dict__) File "C:\\Python27\\Scripts\\build\\SNAPpy279\\out00-PYZ.pyz\\statsmodels.api", line 19, in <module> File "C:\\Python27\\Lib\\site-packages\\PyInstaller\\loader\\pyi_importers.py", line 270, in load_module exec(bytecode, module.__dict__) File "C:\\Python27\\Scripts\\build\\SNAPpy279\\out00-PYZ.pyz\\statsmodels.__init__", line 8, in <module> ImportError: No module named tools.sm_exceptions

Any potentially easy solutions for this? 有任何潜在的简便解决方案吗? Suggestions? 有什么建议吗?

UPDATE: Ran into this once again and my fix did not work. 更新:再次遇到这个问题,但我的修复没有用。 To solve it, I changed the line 为了解决它,我换了线
from .tools.sm_exceptions import (ConvergenceWarning, CacheWriteWarning, IterationLimitWarning, InvalidTestWarning)
In \\statsmodels\\__init__.py at line 8 to : 在\\ statsmodels \\ __ init__.py的第8行中:
from statsmodels.tools.sm_exceptions import (ConvergenceWarning, CacheWriteWarning, IterationLimitWarning, InvalidTestWarning)


I think I ran in the same issue last week. 我想上周我遇到了同样的问题。 In my case, I fixed it by adding 就我而言,我通过添加
import statsmodels.api
in my main script. 在我的主脚本中。
The import was done within another module previously. 导入以前是在另一个模块中完成的。

Hoping this helps. 希望这会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM