First, installation environment and version
CentOS 7
Python 3.6.5
Second, install the Dependency Pack 1, install the static library
# yum install -y openssl-static
Note: If you do not install this static library, it will cause the PIP installation of Python to fail 2, install GCC
# yum install -y gcc wget# yum groupinstall "Development tools"# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
Third, download and install PYTHON31, download Python3 installation package via official website
# wget http://python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
2. Unpack the installation package
# tar xf Python-3.6.5.tar.xz
3. Compile and install
Go to the Python-3.6.5 folder and edit the installation
# ./configure --prefix=/usr/local/python3# make & make install
Note:--prefix setting is python3 to install to the location four, add the file link (add to environment variable) 1, add the newly installed Python3 version of the file connection
# ln -s /usr/local/python3/bin/python3 /usr/bin/python3
View Python3 Version Information
# python3 -VPython 3.6.5
2. Add pip File connection
viewing PIP version Information
# python3 -m pip -Vpip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)
Note: If the output hint does not have a PIP, then perform--five, PIP installation
Add a file connection for PIP
# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
viewing PIP version Information
# pip3 -Vpip 9.0.3 from /usr/local/lib/python3.6/site-packages (python 3.6)
Five, PIP installation 1, install PIP
Download pip
# wget https://bootstrap.pypa.io/get-pip.py
Install PIP
# python3 get-pip.py
viewing PIP version Information
# python3 -m pip -Vpip 9.0.3 from /usr/local/lib/python3.6/site-packages (python 3.6)
2. Adding a PIP to an environment variable
Edit the/etc/profile document, add the following at the end, and save the exit.
export PATH="/usr/local/python3/bin:$PATH"
And then run
# source /etc/profile
viewing PIP version Information
# pip3 -Vpip 9.0.3 from /usr/local/lib/python3.6/site-packages (python 3.6)
At this point, all installations are complete!
CentOS Source Installation Python3.6