Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot import name _args_from_interpreter_flags

Tags:

python

When I try to import multiprocessing in Python 2.7.5 on OS X 10.6.8, I get this error:

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

I also tried to install python2.7.6 with homebrew, but this error still occurs.

like image 947
LH2 Avatar asked Mar 06 '14 21:03

LH2


1 Answers

It sounds like a circular import issue. Try adding this to the the rest of your imports:

from subprocess import _args_from_interpreter_flags

There is a comment above the function in 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.

May be related.

like image 76
anon582847382 Avatar answered Oct 18 '22 20:10

anon582847382