ubuntu 16.04本身是自带python的,他本身是自带2.X和3.X,两个版本,默认的是2.X。这里记录一下如果在版本间切换以及如何把python版本切换到3.X下的方法。
1. See the version of Python installed in Ubuntu and the Python version currently in use
Ls/usr/bin/python*python--version
2. Set Update-alternatives to toggle Python version
Show python in place of version information
Update-alternatives--list python
Show after execution
Update-alternatives:error:no alternatives for Python means Python replaces version not yet installed
Perform a command installation
Update-alternatives--install/usr/bin/python python/usr/bin/python2.7 1
update-alternatives:using/usr/bin/python2.7 to Provide/usr/bin/python (python) in auto mode
Update-alternatives--install/usr/bin/python python/usr/bin/python3.5 2
update-alternatives:using/usr/bin/python3.5 to Provide/usr/bin/python (python) in auto mode
View the default version
Python--version
Because we set the/usr/bin/python3.5 setting to a priority of 2 in the above command, the update-alternatives command itself sets 3.5 as the default
Show Python instead of version information again
Update-alternatives--list python
Toggle version Update-alternatives--config python
sudo update-alternatives --config python
3.python3 version installation pipsudo apt-get install PYTHON3-PIP running pip3-v display version upgrade PIP version PIP3 install--upgrade pip
How to configure the default Python version of Ubuntu