无法导入名称_args_from_interpreter_flags

时间:2014-03-06 21:04:09

标签: python

当我在OS X 10.6.8上的Python 2.7.5中尝试import multiprocessing时,我收到此错误:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/__init__.py", line 65, in <module>
from multiprocessing.util import SUBDEBUG, SUBWARNING
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/util.py", line 40, in <module>
from subprocess import _args_from_interpreter_flags
ImportError: cannot import name _args_from_interpreter_flags

我还尝试用自制软件安装python2.7.6,但仍然会出现此错误。

1 个答案:

答案 0 :(得分:2)

听起来像circular import issue。尝试将其添加到其余导入中:

from subprocess import _args_from_interpreter_flags

subprocess.py中的函数上方有一条评论:

# XXX This function is only used by multiprocessing and the test suite,
# but it's here so that it can be imported when Python is compiled without
# threads.

可能有关系。