PYTHONOPTIMIZE在python解释器中做什么?

2024-09-20 23:00:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我用supervisor运行python任务,当我尝试在python任务中使用multilprocess时,遇到了错误

"File/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/process.py", line 124, in start 

'daemonic processes are not allowed to have children'" 

但是在终端执行命令"export PYTHONOPTIMIZE=1"之后就可以了,任何人都可以告诉我在执行命令"export PYTHONOPTIMIZE=1"时发生了什么


Tags: libusrlocal错误exportframeworkversionsmultiprocessing
1条回答
网友
1楼 · 发布于 2024-09-20 23:00:27

^{} environment variable设置为1与使用^{} command line switch相同:

Remove assert statements and any code conditional on the value of __debug__.

您看到的错误消息是AssertionError异常;relevant section of the source code使用assert

assert not _current_process._daemonic, \
       'daemonic processes are not allowed to have children'

因此,设置环境变量只会抑制断言。问题本身并没有消失。你知道吗

相关问题 更多 >

    热门问题