【发布时间】:2021-12-26 15:21:39
【问题描述】:
在 sublime、pycharm 或 spyder 中运行任何代码时,我总是会收到此消息并且代码会停止。 我目前使用的代码:https://imgur.com/a/fNaUPu2
运行时错误: 已尝试在 当前进程已完成其引导阶段。
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable..
当添加 if name == 'main': 在代码前面它会崩溃:https://imgur.com/a/YyUtWDS
但是当我在 python cmd 中运行相同的代码时,它工作得很好:https://imgur.com/a/ZYPUrJY
如果有帮助,我有一个 5 5600g apu 和 python 3.10
任何帮助将不胜感激, 提前致谢
【问题讨论】:
-
通常主守卫出现在导入语句之后。不确定这是否是您的问题
标签: python sublimetext3