Installing Python
- Download the source code of Python 3.7.5.
1wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz - Decompress Python-3.7.5.tgz.
1tar -zxvf Python-3.7.5.tgz
- Go to the Python source code directory.
1cd Python-3.7.5
- Compile Python.
1 2 3
./configure --prefix=/usr/local/python3.7 --enable-optimizations make make install
- Create a soft link file in the path of the execution file.
1 2
ln -s /usr/local/python3.7/bin/python3 /usr/bin/python3 ln -s /usr/local/python3.7/bin/pip3 /usr/bin/pip3
- Configure environment variables.
- Create a /etc/profile.d/python37.sh file.
1vi /etc/profile.d/python37.sh - Add the following content to the file:
1 2 3 4
if [ -z ${PYTHON37_HOME} ]; then export PYTHON37_HOME=/usr/local/python3.7 export PATH=${PYTHON37_HOME}/bin:${PATH} fi
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Load the environment variables.
1source /etc/profile.d/python37.sh
- Create a /etc/profile.d/python37.sh file.
- Query the Python version.
1python3 --versionIf the following information is displayed, the installation is successful:

Parent topic: Configuring the Environment