[英]Cannot create .exe file with pyinstaller
Language: python 3.7.4语言:python 3.7.4
While I am trying to convert my python file into exe file with pyinstaller, it does not work well.当我尝试使用 pyinstaller 将我的 python 文件转换为 exe 文件时,它无法正常工作。
When I run the following command in the same directory as the python file is saved,当我在保存 python 文件的同一目录中运行以下命令时,
pyinstaller test.py --noconsole --onefile
the following error message appears in the console and get no ".exe" file.控制台中出现以下错误消息,并且没有获取“.exe”文件。
PyInstaller.exceptions.ImportErrorWhenRunningHook: Failed to import module __PyInstaller_hooks_0_pydoc required by hook for module C:\Users\user\Anaconda3\lib\site-packages\PyInstaller\hooks\hook-pydoc.py. Please check whether module __PyInstaller_hooks_0_pydoc actually exists and whether the hook is compatible with your version of C:\Users\hiro\Anaconda3\lib\site-packages\PyInstaller\hooks\hook-pydoc.py: You might want to read more about hooks in the manual and provide a pull-request to improve PyInstaller.
Anyone have some help for this problem?有人对这个问题有帮助吗?
Or, as the last phrase of the error message says,或者,正如错误消息的最后一句话所说,
You might want to read more about hooks in the manual and provide a pull-request to improve PyInstaller.
Pyinstaller have some problem? Pyinstaller 有问题?
If more information needed, I will add.如果需要更多信息,我会补充。 Thank you.
谢谢你。
The error occurred when your main file calls files on other directories.当您的主文件调用其他目录上的文件时发生错误。
For eg :- test.py uses db.py in DB folder.例如:- test.py 在 DB 文件夹中使用 db.py。
Try to execute command with '-D' flag.尝试使用“-D”标志执行命令。
pyinstaller -D --noconsole test.py
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.