1. Install dependent environment
# yum-y Install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-de Vel libpcap-devel xz-devel
2. Download Python3
# wget Https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
3. Installing Python3
I personally used to install in/usr/local/python3 (specific installation location to see a person's preferences)
To create a directory:
# mkdir-p/usr/local/python3
Unzip the downloaded PYTHON-3.X.X.TGZ package (the specific package name is not different for the specific version of Python you downloaded?) and not different, such as: I downloaded the Python3.6.1. Then I'm python-3.6.1.tgz.
# TAR-ZXVF Python-3.6.1.tgz
4. Enter the extracted directory and compile the installation.
# CD python-3.6.1#./configure--prefix=/usr/local/python3
Make
# make
Make install
Make install or make && make install
5. Build Python3 's soft chain
# ln-s/usr/local/python3/bin/python3/usr/bin/python3
6. and add/usr/local/python3/bin to Path
# vim ~/.bash_profile#. bash_profile# Get the aliases and Functionsif [-f ~/.BASHRC]; Then. ~/.bashrcfi# User specific environment and startup Programspath= $PATH: $HOME/bin:/usr/local/python3/binexport PATH
Press ESC, enter: Wq Enter to exit.
After the modification, remember to execute the following line command to make the previous modification effective:
# source ~/.bash_profile
Check if Python3 and PIP3 are normally available:
# Python3-vpython 3.6.1# pip3-vpip 9.0.1 from/usr/local/python3/lib/python3.6/site-packages (Python 3.6)
7. If not, try creating a soft link to PIP3
# ln-s/USR/LOCAL/PYTHON3/BIN/PIP3/USR/BIN/PIP3
Installing Python3 on Linux