简体   繁体   English

Pyinstaller应用程序(控制台)无法正常工作

[英]Pyinstaller app(console) won't work

I've trouble making an CONSOLE app work after packaging. 打包后我无法使CONSOLE应用程序正常工作。 App flashes once and closes. 应用程序闪烁一次并关闭。 in terminal i've put: pyinstaller --onefile --windowed --icon=name.icns Script.py 在终端中,我输入了: pyinstaller --onefile --windowed --icon=name.icns Script.py

So far i've tried running the app through terminal to try and get error ( you know like in windows but it failed lol ). 到目前为止,我已经尝试通过终端运行应用程序以尝试获取错误(您知道像在Windows中一样,但失败了大声笑)。

Is there a way to see the reason why it closed? 有没有办法看到它关闭的原因?

EDIT: When i run Executable within app i get this error: 编辑:当我在应用程序内运行可执行文件时,出现此错误:

File "Script.py", line 14, in <module>


File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
    exec(bytecode, module.__dict__)

File "site-packages/requests/__init__.py", line 43, in <module>

File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
    exec(bytecode, module.__dict__)

File "site-packages/urllib3/__init__.py", line 8, in <module>

File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
    exec(bytecode, module.__dict__)

File "site-packages/urllib3/connectionpool.py", line 28, in <module>

File "site-packages/urllib3/packages/six.py", line 92, in __get__

File "site-packages/urllib3/packages/six.py", line 115, in _resolve

File "site-packages/urllib3/packages/six.py", line 82, in _import_module
ImportError: No module named 'queue'

I have nothing about "queue" in code and .py works great and gives no import error. 我对代码中的“队列”一无所知,.py效果很好,并且没有导入错误。

Thank you. 谢谢。

Seems like there's an error importing one of your modules, perhaps its dependencies aren't being detected correctly. 似乎在导入您的模块之一时出现错误,可能是无法正确检测到其依赖关系。

You can try to explicitly add a module via the command line by including --hidden-import=queue , you might have to do this for more modules that haven't been detected. 您可以尝试通过包含--hidden-import=queue的命令行通过命令行显式添加模块,您可能需要对尚未检测到的更多模块执行此操作。 More discussion in this question . 在这个问题上有更多的讨论。

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

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