Install Python 3.8.2
$ cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
$ python --version
Python 2.7.5
$ which python
/usr/bin/python
$ yum update
$ yum install yum-utils
$ yum-builddep python3
$ wget https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tgz
$ tar -xvzf Python-3.8.2.tgz
$ cd Python-3.8.2
$ ./configure --enable-optimizations
$ make
$ make test
$ make install
$ python3.8 --version
Python 3.8.2
$ which python3.8
/usr/local/bin/python3.8
Since the python2.7 is a default system wide python interpreter and need explicitly set to new version. To change python version only for a single user edit ~/.bashrc.
$ vi ~/.bashrc
alias python='/usr/local/bin/python3.8'
$ cd /root
$ . .bashrc #apply changes
$ python
Python 3.8.2 (default, Apr 27 2020, 08:41:59)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Ref:- linuxconfig.org
$ cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
$ python --version
Python 2.7.5
$ which python
/usr/bin/python
$ yum update
$ yum install yum-utils
$ yum-builddep python3
$ wget https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tgz
$ tar -xvzf Python-3.8.2.tgz
$ cd Python-3.8.2
$ ./configure --enable-optimizations
$ make
$ make test
$ make install
$ python3.8 --version
Python 3.8.2
$ which python3.8
/usr/local/bin/python3.8
Since the python2.7 is a default system wide python interpreter and need explicitly set to new version. To change python version only for a single user edit ~/.bashrc.
$ vi ~/.bashrc
alias python='/usr/local/bin/python3.8'
$ cd /root
$ . .bashrc #apply changes
$ python
Python 3.8.2 (default, Apr 27 2020, 08:41:59)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Ref:- linuxconfig.org
No comments:
Post a Comment