简体   繁体   English

使用 pyinstaller 创建可执行文件时出现问题

[英]Problems creating an executable file with pyinstaller

I want to generate an executable from a python file using pyinstaller, i need something which can be used on windows and hopefully on ubuntu. The generated dist folder containing all the executables is created with the command line:我想使用 pyinstaller 从 python 文件生成一个可执行文件,我需要一些可以在 windows 上使用并希望在 ubuntu 上使用的东西。包含所有可执行文件的生成的 dist 文件夹是使用命令行创建的:

pyinstaller --debug=all gui.py pyinstaller --debug=all gui.py

It creates gui (the executable file) using the gui.py file.它使用 gui.py 文件创建 gui(可执行文件)。

Doing./gui the output is:做./gui output 是:

....
File "ssqueezepy/configs.py", line 150, in <module>
File "ssqueezepy/configs.py", line 107, in _get_gdefaults
FileNotFoundError: [Errno 2] No such file or directory: '/home/pietro/Desktop/ClaraGui/dist/gui/ssqueezepy/configs.ini'
[12263] Failed to execute script 'gui' due to unhandled exception!
[12263] LOADER: OK.
[12263] LOADER: Manually flushing stdout and stderr
[12263] LOADER: Cleaning up Python interpreter.
clear builtins._
clear sys.path
clear sys.argv
...

There are no other errors in the output (sometimes i read "a name of a lib" not found in PYZ). output 中没有其他错误(有时我读到在 PYZ 中找不到的“库的名称”)。 There is a way to fix the error above?有办法解决上面的错误吗? What is the config.ini file requested?请求的 config.ini 文件是什么?

Otherwise, there are other possibilities to achieve the same result?否则,还有其他的可能达到同样的结果吗? In the end I just need an executable which can be used on windows, generated from the code in python on ubuntu.最后我只需要一个可以在 windows 上使用的可执行文件,它是从 python 中的代码在 ubuntu 上生成的。

EDIT: I solved the issue deactivating the virtual environment and installing outside of it the dependencies.编辑:我解决了停用虚拟环境并在其外部安装依赖项的问题。 It's not a fix but it works in my case.这不是解决方法,但它适用于我的情况。

you can try to open command prompt and drag exe into it and press enter, that way you will catch the error (if there is any) and then update your question, more info == more help.您可以尝试打开命令提示符并将 exe 拖入其中,然后按回车键,这样您就会发现错误(如果有的话),然后更新您的问题,更多信息 == 更多帮助。

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

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