简体   繁体   English

Pyinstaller的ModuleNotFoundError

[英]ModuleNotFoundError For Pyinstaller

I wrote a tool with an interface with PyQt5+Python3.6, and I want to pack into an .exe file to run on a machine without a Python environment. 我写了一个带有PyQt5 + Python3.6接口的工具,我想打包成一个.exe文件,以便在没有Python环境的计算机上运行。 According to the online use of pyinstaller to pack, after the end of the package in the dist folder exe file is opened after the error: 根据在线使用pyinstaller进行打包,打包结束后在dist文件夹中的exe文件打开后报错:

ModuleNotFoundError: No module named 'scipy._lib.messagestream' ModuleNotFoundError:没有名为“ scipy._lib.messagestream”的模块

This issue was revised after the hiddenimports of the .spec file was resolved: 解决了.spec文件的hiddenimports后,已解决此问题:

hiddenimports=['scipy._lib.messagestream']

and then the new .exe file generated by the command: 然后由命令生成的新.exe文件:

pyinstaller x.spec

still reports an error. 仍然报告错误。

ModuleNotFoundError: No module named 'typedefs' ModuleNotFoundError:没有名为“ typedefs”的模块

Then, continue to add ... continue to error, all this error... 然后,继续添加...继续错误,所有这些错误...

How do you solve this problem? 你怎么解决这个问题?

Are you working in a virtual environment (venv)? 您是否在虚拟环境(venv)中工作? If so, you should add the site-packages path: 如果是这样,则应添加site-packages路径:

pyinstaller --paths path\to\venv\Lib\site-packages script.py

It happens to me with selenium module until I run pyinstaller with the --paths 硒模块会发生在我身上-直到我使用--paths运行pyinstaller

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

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