简体   繁体   English

不能再用pip了

[英]Can't use pip anymore

When I try to use pip, I met this error: 当我尝试使用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

Obviously, I made some change to the system that broke pip. 显然,我对破坏了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: 我能猜到的是,今天早上,我创建了一个virtualenv,通过运行安装自己编写的包:

python setup.py install python setup.py安装

in that environment. 在那种环境中。

BTW, I did try to reinstall pip by running get-pip.py, didn't work 顺便说一句,我确实尝试通过运行get-pip.py来重新安装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're easy_install ed or pip ed. 我注意到分发安装在/usr/local但是pip在/usr/lib ,所以我猜你在系统范围内安装了旧版本的pip,它以某种方式覆盖了你easy_install ed或pip ed。 I'd start looking there. 我会开始寻找那里。

Reinstall using easy_install. 使用easy_install重新安装。 Close the terminal and reopen. 关闭终端并重新打开。 Pip should now work. 皮普现在应该工作了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM