python2.4和python2.7的easy_install冲突

时间:2012-10-04 09:17:18

标签: python easy-install python-2.x

我已经在CentOS机器上的/opt/python2.7.1/下安装了python,它已经运行python2.4并将其配置为运行python2.7默认。

然而,当我写'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

我认为easy_install下的/usr/bin/链接到python2.4。如何运行/opt/python2.7.1/bin/easy_install默认值?

$ PATH:

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

$ LD_LIBRARY_PATH:

/opt/python2.7.1/lib:

对于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

1 个答案:

答案 0 :(得分:2)

您必须使用virtualenv才能使事情正常运行,并且不必担心具有多个Python版本的系统。

实际上,即使在单个Python版本的系统q中,如果你运行了多个Python应用程序,它也是非常有用的。

Visrtualenv不仅会为你设置所有适当的环境变量来使用一个或另一个Python,因为它允许你使用一个单独的环境,你可以安全地“easy_install”Python 2.4模块而不会与之相冲突这些相同模块的CentOS .rpm包。