Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have installed python under /opt/python2.7.1/ on CentOS machine which has already python2.4 and configure it to run python2.7 default.

However, when I write 'easy_install' it raises error like

Traceback (most recent call last):
    File "/opt/python2.7.1/bin/easy_install", line 5, in ?
        from pkg_resources import load_entry_point
    File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 2482, in ?
        for dist in working_set.resolve(
    File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 483, in resolve
        raise DistributionNotFound(req)  # XXX put more info here
    pkg_resources.DistributionNotFound: setuptools==0.6c11

I think easy_install under /usr/bin/ links to python2.4. How can I run /opt/python2.7.1/bin/easy_install default?

For $PATH:

/opt/python2.7.1/bin:/usr/devs/bin:/usr/local/bin:/bin:/usr/bin:/home/ops/bin

For $LD_LIBRARY_PATH:

/opt/python2.7.1/lib:

For easy_install:

Traceback (most recent call last):
File "/opt/python2.7.1/bin/easy_install", line 5, in ?
    from pkg_resources import load_entry_point
File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 2482, in ?
    for dist in working_set.resolve(
File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 483, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: setuptools==0.6c11
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
166 views
Welcome To Ask or Share your Answers For Others

1 Answer

You have to make use of virtualenv to get things working properly, and without worries in systems with more than one Python version.

Actually, it is quite a help even in system qwith a single Python version, if you have muliple Python apps running.

Visrtualenv will not only take care of setting up all the appropriate environment variables for you to use one Python or another, as it will allow you to use use a separate environment where you can safely "easy_install" Python 2.4 modules without conflicting with CentOS .rpm packages of those same modules.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...