开发者

Resolve pip/virtualenv fiasco after upgrading Python 2.5 to Python 2.6?

开发者 https://www.devze.com 2023-02-19 15:18 出处:网络
I upgraded Python 2.5 to Python 2.6 on my system and it\'s crapping out ( yeah, it\'s my fault but at least this isn\'t a high priority production server ). pip didnt work so I had to manually grab th

I upgraded Python 2.5 to Python 2.6 on my system and it's crapping out ( yeah, it's my fault but at least this isn't a high priority production server ). pip didnt work so I had to manually grab the latest pip which is compatible with Python 2.6.

I now have to use pip-2.6 as the command. Is there a way to make this override pip, which seems to be the reference to the 2.5 package? pip gives me this:

$ pip
Traceback (most recent call last):
  File "/usr/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 2675, in <module>
    parse_requirements(__requires__), Environment()
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 552, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==0.7.2

I did a which pip which gives me:

/usr/local/bin/pip

If I vim into that, I see this:

#!/usr/bin/python2.6
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==0.8.3','console_scripts','pip'
__requires__ = 'pip==0.8.3'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('pip==0.8.3', 'console_scripts', 'pip')()
    )

The other thing is, I did a pip-2.6 install -U virtualenv and invoking virtualenv used to work, but now the 开发者_JAVA百科reference is gone..

$ which virtualenv
/usr/local/bin/virtualenv
$ virtualenv
-bash: /usr/bin/virtualenv: No such file or directory

Could anyone provide insight as to how I can map pip to pip-2.6 and how I can make virtualenv work?


I think the key was logging out or reloading my bash, because they seem to work perfectly now.


Reinstalling pip via easy_install solved the problem for me.


I had a nice pip/virtualenv/virtualenvwrapper environment set up and the upgrade to Ubuntu Natty caused those DistributionNotFound errors to be thrown. This is due to the Python version being updated I presume. Here is what fixed the problem for me:

run as root:

easy_install pip
pip install virtualenv


I ended up at this page because I wanted to upgrade the version of pip on my Lucid VPS 1 and also ended up having to use pip-2.6 as the command. Closing my PuTTY session then logging back in and reloading my bash worked for me, although it was probably just the restarting of the session that did the trick.

I did not want to use easy_install to reinstall pip as I am using Lucid and want the newer (Oneiric) version of Pip, the one that supports uninstall. Earlier, I had added support for manual downloads of lucid-backports 2, but linuxnoobishly was not able to figure out how to actually install the backported version. I decided to just do it using Curl.

0

精彩评论

暂无评论...
验证码 换一张
取 消