Ubuntu18.04 switch Python version

# Foreword##

Ubuntu18.04 installs two versions Python2.7 and Python3.6 by default

# View available binaries###

$ ls /usr/bin/python*

1

# Process##

Use update-alternatives to change the global Python version

# View all available versions###

$ update-alternatives --list python

1

If an error occurs: update-alternatives: error: no alternatives for python

$ update-alternatives --install /usr/bin/python python /usr/bin/python2.71
$ update-alternatives --install /usr/bin/python python /usr/bin/python3.62

1
2

The numbers 1 and 2 at the end of the command indicate priority, and now use 2 by default

# Select version###

$ update-alternatives --config python

1

# Verification##

$ python --version

1

Recommended Posts

Ubuntu18.04 switch Python version
Ubuntu16.04 switch python version
Install TensorFlow (python2.7 version) on Ubuntu
Ubuntu16 upgrade Python3
ubuntu18.04 install python2
Relearn ubuntu --python3
ubuntu12.04 install python3
ubuntu18.04 install python
ubuntu16.04 upgrade python2
Install the latest Python 3.6 version on Ubuntu
Install python3.6 under Ubuntu 16.04
ubuntu configuration python, Red
Python MySQLd under Ubuntu
[python] python2 and python3 under ubuntu
Install Python3 on Ubuntu 14.04
Python virtual environment: Ubuntu16.04
Install python in Ubuntu
Install Python3 on Ubuntu 16.04
python tic-tac-toe-text version (part 2)
PyCharm set Python version
Install Python3.7 on Ubuntu
python Tic-Tac-Toe-text version (on)
ubuntu16.04 install caffe cpu version
Ubuntu install the latest Python 3.
Install Python 3.7 on Ubuntu 18.04 LTS
ubuntu sets python2.5 environment variables
ubuntu18.04 compile and install python3.8
ubuntu view python installation path
Python implements text version minesweeper
Python version of OpenCV installation
ubuntu build python development environment
Ubuntu 16.04 cannot switch root permissions
ubuntu offline installation python environment
How to install Python 3.8 on Ubuntu 18.04
Python version business card management system
Python Chinese encoding setting under ubuntu
Install Python virtual environment on Ubuntu 18.04
Detailed tutorial on installing python3.7 for ubuntu18
Openstack G version Ubuntu13.04 three-node experiment record
Error when installing Python module on Ubuntu
Why doesn't Python support the switch statement?
Which version of python does windows support
Ubuntu18.04 Server version installation and use (graphic)
Install fonts on Ubuntu and switch default fonts
Why doesn't Python support the switch statement?
How to install Python2 on Ubuntu20.04 ubuntu/focal64
Deploy python3 and nginx projects on ubuntu18.04
The relationship between Open3D version and Ubuntu
Install jetty in Ubuntu 18.04 Server, non-apt version
Use python3 to install third on ubuntu
Build a python development environment under Ubuntu
Why doesn't Python support the switch statement?
Python implements AI automatic version greedy snake