环境

python在IDE中运行时正常,打包成exe文件后,再执行退出时却报"'exit' is not defined"

报错代码解读

Traceback (most recent call last):
  File "Auto Replace.py", line 176, in <module>
NameError: name 'exit' is not defined
[10012] Failed to execute script Auto Replace

解决办法

更改代码为sys.exit()后成功解决

import sys
sys.exit(0)
Last modification:March 11th, 2020 at 09:45 am
If you think my article is useful to you, please feel free to appreciate