【Error】ImportError: cannot import name _remove_dead_weakref
阿新 • • 發佈:2018-12-29
安裝lldb外掛(https://github.com/snare/voltron/wiki/Installation)後,lldb啟動報錯:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/local/Cellar/[email protected]/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in <module>
import weakref
File "/usr/local/Cellar/ [email protected]/2.7.15_1/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
搜素了一下大概明白了原因。macOS自帶的python verison是2.7.10,在/usr/bin/python。而通過brew安裝的python名是[email protected],在/usr/local/bin/python。兩個python用到的pip包不同。網友提供的辦法大多是remove [email protected]。因此只需要讓lldb載入時用系統自帶的python即可,修改一下環境變數。
解決方法:
export PATH=/usr/bin:$PATH
# 或 brew remove [email protected] --ignore-dependencies
參考:
https://askubuntu.com/questions/981663/python2-7-broken-by-weakref-import-error-please-help