Can't use pip anymore

2019-02-13 22:28发布

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

标签: python pip
2条回答
走好不送
2楼-- · 2019-02-13 22:45

Reinstall using easy_install. Close the terminal and reopen. Pip should now work.

查看更多
Lonely孤独者°
3楼-- · 2019-02-13 22:50

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_installed or piped. I'd start looking there.

查看更多
登录 后发表回答