Pyinstaller,NameError:未定义全局名称“退出" [英] Pyinstaller, NameError: global name 'quit' is not defined
本文介绍了Pyinstaller,NameError:未定义全局名称“退出"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个运行良好的 python 脚本,但是在运行 pyinstaller 之后,当我使用 quit()
或 exit()
命令时,我得到以下信息:
I have a python script which runs just fine, however after running pyinstaller, I get the following when I use a quit()
or exit()
command:
Makespec 文件:
Makespec file:
# -*- mode: python -*-
a = Analysis([os.path.join(HOMEPATH,'support/_mountzlib.py'), os.path.join(HOMEPATH,'support/useUnicode.py'), 'icinga.py'],
pathex=['/home/user/projects/icinga_python/releases/onefile_v1.0'])
pyz = PYZ(a.pure)
exe = EXE( pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name=os.path.join('dist', 'icinga'),
debug=False,
strip=False,
upx=True,
console=1 )
这是我运行应用程序后看到的:
Here is what I see after I run the app:
Traceback (most recent call last):
File "<string>", line 222, in <module>
File "<string>", line 207, in main
File "<string>", line 66, in icinga_mysql
File "<string>", line 45, in checksanity
NameError: global name 'quit' is not defined
推荐答案
那是因为没有 quit
命令.您正在寻找 sys.exit
.
That is because there is no quit
command. You are looking for sys.exit
.
这篇关于Pyinstaller,NameError:未定义全局名称“退出"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文