我正在安裝一個新的mac,我一直在嗡嗡聲,安裝pip和一些軟件包。當突然,每個PIP命令我嘗試運行會拋出pip給「ImportError:沒有名爲setuptools的模塊」,但我可以在python解釋器中導入setuptools
Exception:
Traceback (most recent call last):
File "/Library/Python/2.6/site-packages/pip-1.2.1-py2.6.egg/pip/basecommand.py", line 107, in main
status = self.run(options, args)
File "/Library/Python/2.6/site-packages/pip-1.2.1-py2.6.egg/pip/commands/install.py", line 248, in run
import setuptools
ImportError: No module named setuptools
我算了一下,不小心刪除一個目錄或什麼的,所以我嘗試重新安裝setuptools的,下面的other answers本網站上的意見。我從here下載了setuptools egg,並像shell腳本那樣運行它。得到這個輸出:
Processing setuptools-0.6c11-py2.7.egg
Removing /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg
Copying setuptools-0.6c11-py2.7.egg to /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
setuptools 0.6c11 is already the active version in easy-install.pth
Installing easy_install script to /Library/Frameworks/Python.framework/Versions/2.7/bin
Installing easy_install-2.7 script to /Library/Frameworks/Python.framework/Versions/2.7/bin
Installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg
Processing dependencies for setuptools==0.6c11
Finished processing dependencies for setuptools==0.6c11
現在,如果我開始一個交互式的Python會話,我可以import setuptools
沒有錯誤,但PIP(和其他命令行腳本)抱怨說,它沒有安裝。任何想法爲什麼Python似乎找到它,但不是其他腳本?
如果有幫助,這是什麼在sys.path
:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
請注意,您的pip錯誤顯示跟蹤中的Python 2.6,但其餘部分正在使用Python 2.7您的pip頂級腳本的頂部行是什麼樣的? – Keith