- Download python3.8 source package
wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3rc1.tgz
- Unzip the source package
tar -zxvf Python-3.8.3rc1.tgz
- Enter the source package file
cd Python-3.8.3rc1
- Specify the installation directory as /opt/python3.8 (this step will take a long time)
./configure --prefix=/opt/python3.8
- According to the prompt, execute the following code (this step will take a long time)
./configure --enable-optimizations
- Compile and install (this step will take a long time)
make && make install
- Change the path variable of linux and add python3
/etc/profile # System environment variable configuration file
Open the system environment variable configuration file with vim editor: vim /etc/profile
vim /etc/profile
Configure environment variables
PATH=/opt/python3.8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
- Reload configuration file /etc/profile
source /etc/profile
- Check whether python and pip are installed successfully