When I try to run the Python interpreter in lldb, I see:
$ lldb
(lldb) script
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in <module>
import weakref
File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module>
from _weakref import (
ImportError: cannot import name _remove_dead_weakref
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
When I check which version of Python was running, Python reports that it should be Python Homebrew (which is symbolically attached to this place):
>>> sys.executable
'/usr/local/opt/python/bin/python2.7'
However, asking for a version of Python returns the version associated with setting Python by default, for example.
>>> sys.version_info
sys.version_info(major=2, minor=7, micro=10, releaselevel='final', serial=0)
And, just to confirm, the version of Python on the binary path above is really different (note the difference in the micro version):
$ /usr/local/opt/python/bin/python2.7 --version
Python 2.7.14
$ /usr/bin/python --version
Python 2.7.10
To make things more confusing, a name _remove_dead_weakrefexists in the module _weakreffor my installation on Homebrew Python, but not for the default installation:
$ /usr/bin/python -c "import _weakref; print _weakref._remove_dead_weakref"
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute '_remove_dead_weakref'
$ /usr/local/opt/python/bin/python2.7 -c "import _weakref; print _weakref._remove_dead_weakref"
<built-in function _remove_dead_weakref>
, Python LLDB? ?