2

I'm currently using centos web admin. I tried to change default python version from 2 into 3. I already done it as you can see from the result below:

[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

My problem start when I'm trying to install setuptools, it looks like the setuptools not installed into python3.6 site-packages but the old python version 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

How to solve this?

Kevin A.S.
  • 123
  • 7

1 Answers1

0

You can solve this using the command that the easy_install docs shared in case of multiple python version installed:

python3 -m easy_install

or instead if you have easy_install installed for both python version, you can use easy_install-3.2 for python 3.x versions and easy_install-2.7 for python 2.x versions.

Claudio
  • 123
  • 3
  • 15
  • I have following your order, but the ssh said "No module named easy_install" – Kevin A.S. Jun 20 '19 at 07:43
  • you runned `python3 easy_install setuptools`? – Claudio Jun 20 '19 at 07:50
  • probably you have `easy_install` installed only for the python 2.x version... try to install it also for the python 3.x following this guide: https://setuptools.readthedocs.io/en/latest/easy_install.html#installing-easy-install then retry the previous command – Claudio Jun 20 '19 at 08:09
  • My problem has been solved. I reinstall python, add alias for new python and new pip, then add the old site package into new python environment. Tq for helping – Kevin A.S. Jun 20 '19 at 08:49