简体   繁体   English

python2.4和python2.7的easy_install冲突

[英]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. 我已经在已经安装了python2.4的CentOS机器上的/opt/python2.7.1/下安装了python,并将其配置为运行python2.7默认。

However, when I write 'easy_install' it raises error like 但是,当我写“ 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

I think easy_install under /usr/bin/ links to python2.4. 我认为/usr/bin/下的easy_install链接到python2.4。 How can I run /opt/python2.7.1/bin/easy_install default? 如何运行/opt/python2.7.1/bin/easy_install默认值?

For $PATH: 对于$ PATH:

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

For $LD_LIBRARY_PATH: 对于$ LD_LIBRARY_PATH:

/opt/python2.7.1/lib:

For easy_install: 对于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

You have to make use of virtualenv to get things working properly, and without worries in systems with more than one Python version. 您必须使用virtualenv才能使一切正常运行,并且在具有多个Python版本的系统中也不必担心。

Actually, it is quite a help even in system qwith a single Python version, if you have muliple Python apps running. 实际上,即使您运行的是多个Python应用程序,即使在具有单个Python版本的系统q中,这也都非常有帮助。

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. Visrtualenv不仅会为您设置所有适当的环境变量,以便使用一个或多个Python,因为它允许您使用单独的环境,在该环境中可以安全地“轻松安装” Python 2.4模块而不会与CentOS .rpm冲突。相同模块的软件包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM