linux安装指定版本Python以及对应的pip教程。

指定Python版安装:

以Python3.8.13为例,需要其它版本修改版本号即可

安装依赖:

apt -y update
apt -y install git libffi-dev gcc zlib1g-dev libbz2-dev libssl-dev ncurses-dev libsqlite3-dev libreadline-dev tk-dev libgdbm-dev db4otool libpcap-dev xz-utils make

 

一键命令:

wget https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz
tar -zxvf Python-3.8.13.tgz
cd Python-3.8.13
./configure --prefix=/usr/local/python/3.8.13 --enable-optimizations
make && make install

安装Python对应版本的pip:

以Python3.8.13安装pip为例:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.8 get-pip.py

 

 

 

THE END