I am trying to configure python to 3.9 on CentOS 6.
Here is my steps:
[root@quickstart ~]# alternatives --install /usr/bin/python python /usr/local/bin/python3.9 10
[root@quickstart ~]# alternatives --config python
There is 1 program that provides 'python'.
Selection Command
-----------------------------------------------
*+ 1 /usr/local/bin/python3.9
Enter to keep the current selection[+], or type selection number: 1
[root@quickstart ~]# alternatives --display python
python - status is manual.
link currently points to /usr/local/bin/python3.9
/usr/local/bin/python3.9 - priority 10
Current `best' version is /usr/local/bin/python3.9.
[root@quickstart ~]# alternatives --set python /usr/local/bin/python3.9
But when I issue python --version, still is 2.6
[root@quickstart ~]# python --version
**Python 2.6.6**
[root@quickstart ~]#
EDIT: even following the steps, the $PATH still has the python 2.6 in the first argument. Could be it? where is the $PATH configured? neither /etc/bashrc or ~/.bashrc doesn't have it.
[root@quickstart ~]# whereis python
python: /usr/bin/python2.6 /usr/bin/python /usr/bin/python2.6-config /usr/lib/python2.6 /usr/lib64/python2.6 /usr/local/bin/python3.9-config /usr/local/bin/python3.9 /usr/local/lib/python3.9 /usr/include/python2.6 /usr/share/man/man1/python.1.gz
[root@quickstart ~]#
EDIT 2:
The /etc/alternatives has the python as 3.9, but not globaly.
[root@quickstart alternatives]# pwd
/etc/alternatives
[root@quickstart alternatives]# ./python --version
Python 3.9.10
[root@quickstart alternatives]# python --version
Python 2.6.6
[root@quickstart alternatives]#
Asked by Astora
(509 rep)
Feb 10, 2022, 11:19 AM
Last activity: May 2, 2024, 07:01 AM
Last activity: May 2, 2024, 07:01 AM