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
- Uninstall pip: sudo apt-get remove python-pip
- Install the download tool: sudo apt install curl
- curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
- Install pip: sudo python3 get-pip.py
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 )