我试图在从python 2.7升级到3.6并同时移动到scipy 1.0.0之后使用 pyinstaller 来压缩我们的代码https://bitbucket.org/OES_muni/massiveoes。我正在研究64位win7机器。程序本身运行正常,pyinstaller运行没有错误但是当我尝试运行构建exe文件时它给了我这个错误:
Traceback (most recent call last): File "massiveOES\GUI.py", line 23, in <module> File "c:\users\petr\envs\py1\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__) File "massiveOES\__init__.py", line 1, in <module> File "c:\users\petr\envs\py1\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__) File "massiveOES\FHRSpectra.py", line 1, in <module> File "c:\users\petr\envs\py1\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__) File "massiveOES\spectrum.py", line 3, in <module> File "c:\users\petr\envs\py1\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__) File "site-packages\scipy\optimize\__init__.py", line 241, in <module> File "c:\users\petr\envs\py1\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__) File "site-packages\scipy\optimize\_minimize.py", line 28, in <module> File "c:\users\petr\envs\py1\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__) File "site-packages\scipy\optimize\_trustregion_krylov.py", line 2, in <module> File "c:\users\petr\envs\py1\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__) File "site-packages\scipy\optimize\_trlib\__init__.py", line 1, in <module> File "c:\users\petr\envs\py1\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 714, in load_module
module = loader.load_module(fullname) File "messagestream.pxd", line 5, in init scipy.optimize._trlib._trlib ModuleNotFoundError: No module named 'scipy._lib.messagestream' [2128] Failed to execute script GUI
答案 0 :(得分:17)
好的,以下内容为我解决了当前问题:编辑pyinstaller .spec
文件,使用Scipy
添加以下隐藏导入:
hiddenimports=['scipy._lib.messagestream']
有关详情,请参阅my question。