“ easy_install setuptools”是否将setuptools安装到其他站点包中?

时间:2019-06-20 06:19:27

标签: python centos7 site-packages

我当前正在使用centos Web管理员。我尝试将默认的python版本从2更改为3。正如您从以下结果中看到的那样,我已经做到了:

[root@srv ~]# which python
/usr/bin/python

[root@srv ~]# python -V
Python 3.6.8

[root@srv ~]# python -m site
sys.path = [
    '/root',
    '/usr/lib64/python36.zip',
    '/usr/lib64/python3.6',
    '/usr/lib64/python3.6/lib-dynload',
    '/usr/local/lib/python3.6/site-packages',
    '/usr/local/lib/python3.6/site-packages/setuptools-33.1.1-py3.6.egg',
    '/usr/lib64/python3.6/site-packages',
    '/usr/lib/python3.6/site-packages',
]
USER_BASE: '/root/.local' (doesn't exist)
USER_SITE: '/root/.local/lib/python3.6/site-packages' (doesn't exist)
ENABLE_USER_SITE: True

当我尝试安装setuptools时,我的问题就开始了,它看起来好像没有安装到python3.6站点软件包中,而是旧的python版本2.7。

[root@srv ~]# easy_install setuptools
Searching for setuptools
Best match: setuptools 41.0.1
Adding setuptools 41.0.1 to easy-install.pth file
Installing easy_install script to /usr/bin
Installing easy_install-3.6 script to /usr/bin

Using /usr/lib/python2.7/site-packages
Processing dependencies for setuptools
Finished processing dependencies for setuptools

如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

如果安装了多个python版本,则可以使用easy_install docs共享的命令来解决此问题:

python3 -m easy_install

或者相反,如果您同时安装了两个Python版本的easy_install,则可以将easy_install-3.2用于python 3.x版本,将easy_install-2.7用于python 2.x版本。