无法再使用 pip
当我尝试使用 pip 时,遇到了这个错误:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in <module>
load_entry_point('pip==1.0.2', 'console_scripts', 'pip')()
File "/usr/local/lib/python2.6/dist-packages/distribute-0.6.21-py2.6.egg/pkg_resources.py", line 337, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python2.6/dist-packages/distribute-0.6.21-py2.6.egg/pkg_resources.py", line 2281, in load_entry_point
return ep.load()
File "/usr/local/lib/python2.6/dist-packages/distribute-0.6.21-py2.6.egg/pkg_resources.py", line 1996, in load
raise ImportError("%r has no %r attribute" % (entry,attr))
ImportError: <module 'pip' from '/usr/lib/pymodules/python2.6/pip/__init__.pyc'> has no 'main' attribute
显然,我对系统做了一些更改,导致了 pip 的损坏。但我不知道那是什么。出现上述异常的原因可能是什么?
编辑:
我可以猜测的是,今天早上,我创建了一个 virtualenv,通过运行以下命令安装了我自己编写的包:
python setup.py 安装
。
顺便说一句,我确实尝试通过运行 get-pip.py 重新安装 pip,但没有成功
When I try to use pip, I met this error:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in <module>
load_entry_point('pip==1.0.2', 'console_scripts', 'pip')()
File "/usr/local/lib/python2.6/dist-packages/distribute-0.6.21-py2.6.egg/pkg_resources.py", line 337, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python2.6/dist-packages/distribute-0.6.21-py2.6.egg/pkg_resources.py", line 2281, in load_entry_point
return ep.load()
File "/usr/local/lib/python2.6/dist-packages/distribute-0.6.21-py2.6.egg/pkg_resources.py", line 1996, in load
raise ImportError("%r has no %r attribute" % (entry,attr))
ImportError: <module 'pip' from '/usr/lib/pymodules/python2.6/pip/__init__.pyc'> has no 'main' attribute
Obviously, I made some change to the system that broke pip. But I've no idea what it is. What might cause the exception above?
Edit:
What I can guess is that this morning, I crated a virtualenv, installed a package written by myself by running:
python setup.py install
in that environment.
BTW, I did try to reinstall pip by running get-pip.py, didn't work
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我注意到,distribute 安装在
/usr/local
中,但 pip 位于/usr/lib
中,所以我猜测您在系统范围内安装了旧版本的 pip这在某种程度上覆盖了您所easy_install
或pip
的内容。我会开始在那里寻找。I note that distribute is installed in
/usr/local
but pip is in/usr/lib
, so I'm guessing that you have an older version of pip installed system wide that is somehow overriding what you'reeasy_install
ed orpip
ed. I'd start looking there.使用 easy_install 重新安装。关闭终端并重新打开。 Pip 现在应该可以工作了。
Reinstall using easy_install. Close the terminal and reopen. Pip should now work.