CENTOS8 installs Python3 to the specified directory

1. Download Python 3.8.0

wget https ://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.gz

2. Unzip

tar -zxvf Python-3.8.0.tar.gz

Description: tar parameter

Independent parameters

 -c: 建立压缩档案
 -x:解压
 -t:查看内容
 -r:向压缩归档文件末尾追加文件
 -u:更新原压缩包中的文件

These five are independent commands. One of them is required for compression and decompression. It can be used in conjunction with other commands but only one of them. The following parameters are optional when compressing or decompressing files as needed.

 -z:有gzip属性的
 -j:有bz2属性的
 -J:具有xz属性的(注3)
 -Z:有compress属性的
 -v:显示所有过程
 -O:将文件解开到标准输出

The following parameter -f is required 
-f: Use the file name. Remember, this parameter is the last parameter and only the file name can be followed.

3. Installation

First create a compilation and installation directory

mkdir /usr/local/python3

cd Python-3.8.0

./configure --prefix=/usr/local/python3 --enable-optimizations --with-ssl

Description: The first parameter specifies the installation path, the second parameter can increase the code running speed (10-20%), and the third parameter requires SSL to install pip

make && make install

4. Create soft connection

ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3

5. Verification

python -V

pip -V

 

 

 

 

 

 

 

Guess you like

Origin blog.csdn.net/tswang6503/article/details/112786588