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
00:40 Other alternatives are Pipenv and Poetry. Like Conda, these tools merge virtual environments and package management into a single utility. Pipenv aims to bring the best of all packaging worlds to Python.
Sometimes when you are installing packages, you might face the error: pip: command not found . This error could be due to the following reasons: Pip is not installed. Pip is installed, but it is not compatible with the current environment.
To force re-download use the --no-cache-dir flag. Note that this command also reinstalls all dependencies. Add --no-deps to avoid that, as suggested in Finn's answer below.
If pip is broken after an attempted upgrade to a newer version, try the following: Download get-pip.py and "Save As" the file using right-click. Open a command prompt as an administrator. cd to the path where you saved the file, in my case cd C:\Users\xyz\Downloads> then type python get-pip.py .
Reinstall using easy_install. Close the terminal and reopen. Pip should now work.
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. I'd start looking there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With