Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
170 views
in Technique[技术] by (71.8m points)

python - easy_install conflict for python2.4 and python2.7

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

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

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...