这是我在stackoverflow上的第一篇文章,尽管我已经使用这个网站很长一段时间了。很高兴能够进入社区。 p>
(我对python很新,尤其是PyInstaller)我正在开发一个基于tkinter的数据探索GUI,它非常依赖pandas和numpy,并且还使用了sklearn.linear_model模块。我有一个venv设置,我能够运行PyInstaller并成功创建一个.exe。但是,当我尝试打开程序时(通过命令行),它会抛出:
"ImportError: DLL load failed: The specified module could not be found."
错误发生在脚本中的import sklearn.linear_model as lin
行上。我尝试为内容为hiddenimports = ['sklearn.linear_model']
的模块创建一个钩子无济于事,并且已经在互联网上挖掘了几个小时,似乎无法找到答案。
如果我注释掉导入,PyInstaller继续正常工作,而.exe工作 - 程序打开就好了,但当然与线性模型相关的功能不可用。所以我似乎把它缩小到模块,但当然,下一步该做什么?毫无头绪。
这是追溯:
(venv_py35) C:\Users\ts012096\Desktop\Python\ToolBox\Draft01>dist\CrashDET_draft
01\CrashDET_draft01.exe
Traceback (most recent call last):
File "CrashDET_draft01.py", line 28, in <module>
import sklearn.linear_model as lin
File "c:\users\ts012096\desktop\python\toolbox\draft02\venv_py35\lib\site-pack
ages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__)
File "lib\site-packages\sklearn\__init__.py", line 134, in <module>
File "c:\users\ts012096\desktop\python\toolbox\draft02\venv_py35\lib\site-pack
ages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__)
File "lib\site-packages\sklearn\base.py", line 13, in <module>
File "c:\users\ts012096\desktop\python\toolbox\draft02\venv_py35\lib\site-pack
ages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__)
File "lib\site-packages\sklearn\utils\__init__.py", line 11, in <module>
File "c:\users\ts012096\desktop\python\toolbox\draft02\venv_py35\lib\site-pack
ages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__)
File "lib\site-packages\sklearn\utils\validation.py", line 18, in <module>
File "c:\users\ts012096\desktop\python\toolbox\draft02\venv_py35\lib\site-pack
ages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__)
File "lib\site-packages\sklearn\utils\fixes.py", line 144, in <module>
File "c:\users\ts012096\desktop\python\toolbox\draft02\venv_py35\lib\site-pack
ages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__)
File "lib\site-packages\scipy\sparse\linalg\__init__.py", line 114, in <module
>
File "c:\users\ts012096\desktop\python\toolbox\draft02\venv_py35\lib\site-pack
ages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__)
File "lib\site-packages\scipy\sparse\linalg\isolve\__init__.py", line 6, in <m
odule>
File "c:\users\ts012096\desktop\python\toolbox\draft02\venv_py35\lib\site-pack
ages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__)
File "lib\site-packages\scipy\sparse\linalg\isolve\iterative.py", line 7, in <
module>
File "c:\users\ts012096\desktop\python\toolbox\draft02\venv_py35\lib\site-pack
ages\PyInstaller\loader\pyimod03_importers.py", line 714, in load_module
module = loader.load_module(fullname)
ImportError: DLL load failed: The specified module could not be found.
[46628] Failed to execute script CrashDET_draft01
很想了解您对此的见解。谢谢!
Python v3.5.3 PyInstaller 3.4.dev0 + 5f9190544 sklearn版本0.19.1 所有模块都应该是最新的。