ubuntu18.04 install python3.7

statement

1. The ubuntu18.04 system comes with python2.7 and python3.6.
2. Do not uninstall the python version that comes with ubuntu.
3. Different versions of python can coexist under ubuntu, and python3.7 can be installed directly.

installation

1. Python3.7 installation

sudo apt install python3.7

2. Point python3 to python3.7

cd /usr/bin
sudo rm /usr/bin/python3
sudo ln -s python3.7 python3

3. pip installation

If an error is reported
(solution: add source (on the original basis):
deb http://cn.archive.ubuntu.com/ubuntu bionic main multiverse restricted universe deb http://cn.archive.ubuntu.com/ubuntu bionic- updates main multiverse restricted universe deb http://cn.archive.ubuntu.com/ubuntu bionic-security main multiverse restricted universe deb http://cn.archive.ubuntu.com/ubuntu bionic-proposed main multiverse restricted universe
install distutils, Solve the error problem: sudo apt-get install python3-distutils install
again: sudo python3 get-pip.py )

Guess you like

Origin blog.csdn.net/u013947963/article/details/96141247