install python3.8 on centos8

  1. Download python3.8 source package
wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3rc1.tgz
  1. Unzip the source package
tar -zxvf Python-3.8.3rc1.tgz
  1. Enter the source package file
cd Python-3.8.3rc1
  1. Specify the installation directory as /opt/python3.8 (this step will take a long time)
./configure --prefix=/opt/python3.8 
  1. According to the prompt, execute the following code (this step will take a long time)
./configure --enable-optimizations
  1. Compile and install (this step will take a long time)
make && make install
  1. 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

insert image description here
Configure environment variables

PATH=/opt/python3.8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
  1. Reload configuration file /etc/profile
source /etc/profile
  1. Check whether python and pip are installed successfully
    insert image description here

Guess you like

Origin blog.csdn.net/wjl__ai__/article/details/122017439