我目前正在使用 centos 网络管理员。我尝试将默认 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 时,我的问题开始了,看起来 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
如何解决这个问题?