gpt4 book ai didi

python - 在 linux 上使用 pyinstaller 将 python 编译为二进制文件时未定义退出

转载 作者:行者123 更新时间:2023-12-01 04:00:17 26 4
gpt4 key购买 nike

我有一个套接字服务器 python 脚本,它在 Linux 上运行良好,但是当使用 pyinstaller 在 Linux 上编译为二进制文件时,它会遇到有线情况

File "<string>", line 426, in <module>
File "<string>", line 49, in __init__
NameError: global name 'exit' is not defined

环境:

Linux 2.6.32, python2.6.6, pyinstaller 2.0

这是一个可以重现此错误的简单测试脚本

程序:

exit.__class__

编译命令:

pyinstaller.py -F --noconsole --out=/output_folder/ /source/path

期望打印出:

<class 'site.Quitter'>

希望有人能给我一个线索,共享库的东西?

最佳答案

已解决,明确使用 sys.exit(1) 来跳过此问题。

关于python - 在 linux 上使用 pyinstaller 将 python 编译为二进制文件时未定义退出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36684343/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com