Ubuntu18.04安装python3.6、python3.7和python3.8

Ubuntu 18.04.3 LTS
apt方式
使用root用户或具有sudo访问权限的用户身份运行以下命令

apt update
apt install software-properties-common
add-apt-repository ppa:deadsnakes/ppa

3.6.9

apt install python3.6
python3.6

3.7.4

apt install python3.7
python3.7

3.8.1

apt install python3.8
python3.8

离线编译安装

tar zxvf Python-3.6.7.tgz
cd Python-3.6.7
./configure --prefix=/usr/local/python3.6 --enable-optimizations
make && make install

ln -s /usr/local/python3.6/bin/python3.6 /usr/bin/python
ln -s /usr/local/python3.6/bin/pip3.6 /usr/bin/pip

你可能感兴趣的:(python,linux)