CentOS7 installation Python3.6.8
1. Install depend on the environment
yum -y groupinstall "Development tools"
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
2, download Python3.6.8
Create a / usr / local / python3 folder
mkdir /usr/local/python3
In the folder where you downloaded the installation package python3
(/usr/local/python3 )
wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz
unzip files
tar -xvf Python-3.6.8.tar.xz
3, installation Python3
Create a path to the installation files
mkdir /usr/local/python3
4, the compiler (in the unzipped folder /usr/local/python3/python3.6.8)
./configure --prefix=/usr/local/python3
5, is mounted (the unpacked folder /usr/local/python3/python3.6.8)
make
make install # 先make再make install
6, create a new version of soft link
Modify the old version
mv /usr/bin/python /usr/bin/python_bak
mv /usr/bin/pip /usr/bin/pip_bak
Create a new soft connection
ln -s /usr/local/python3/bin/python3 /usr/bin/python
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip
Check the python version
python -V
7. After successful configuration, pip3 not take the need for further configuration
The / usr / local / python3 / bin join PATH
vim ~/.bash_profile
Modified as follows:
.bash_profile
#Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi # User specific environment and startup programs PATH=$PATH:$HOME/bin:/usr/local/python3/bin export PATH
Copy the code
save and exit, execute the following command, so that the step changed successfully
source ~/.bash_profile
carry out!
However, yum is py2 write, so after you replace the python path, an error may occur yum
so to modify the configuration file
vim /usr/bin/yum
vim /usr/libexec/urlgrabber-ext-down
The first line of the python instead python2