簡體   English   中英

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

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

當我運行.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

有任何潛在的簡便解決方案嗎? 有什么建議嗎?

更新:再次遇到這個問題,但我的修復沒有用。 為了解決它,我換了線
from .tools.sm_exceptions import (ConvergenceWarning, CacheWriteWarning, IterationLimitWarning, InvalidTestWarning)
在\\ statsmodels \\ __ init__.py的第8行中:
from statsmodels.tools.sm_exceptions import (ConvergenceWarning, CacheWriteWarning, IterationLimitWarning, InvalidTestWarning)


我想上周我遇到了同樣的問題。 就我而言,我通過添加
import statsmodels.api
在我的主腳本中。
導入以前是在另一個模塊中完成的。

希望這會有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM