Saturday. February 24, 2018 - 1 min Installing Python 3.6 on Linux Table of Contents Python3.6 Installation Install Packages yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
Download and unpack 1. Download specific python 3 version as needed
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
2.Unpack
tar -xf Python-3.6.1.tgz
3.进入目录
cd Python-3.6.1/
./configure --prefix = /usr/local/python3
make
make install
Create symbolic link 1.Remove the symbolic link of old version Python
mv /usr/bin/python /usr/bin/python_bak
2.Symlink /usr/local/python3/bin/python3 to /usr/bin/python
ln -s /usr/local/python3/bin/python3 /usr/bin/python
Check version python -V
Problem Solving After switching the default Python version of the system to Python 3, There have two problems will occur~ yum and pip3 cannot be used, the solution is as follows
How to fix yum Error Error:
[ root@Topaz tools]# yum -y install xxx
File "/usr/bin/yum" , line 30
Fixing:
//shangbang point to python 2.7
[ root@Topaz tools]# vim /usr/bin/yum
#!/usr/bin/python2.7
// CentOS7 need to modify /usr/libexec/urlgrabber-ext-down as well
[ root@Topaz tools]# vim /usr/libexec/urlgrabber-ext-down
#!/usr/bin/python2.7
How to fix pip3 can not be used Symlink /usr/local/python3/bin/pip3 to /usr/bin
ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3
Topaz Always keep learning.