Ubuntu查看所有的python版本以及进行默认python版本切换

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36470920/article/details/88598946

查看自己Ubuntu16.04中的python都装了哪些版本

使用指令

python3 --version

 来查看python3的版本有哪些

python2 --version

 来查看python2的版本有哪些

血泪教训,一定不要擅自删除Ubuntu自带的python版本,否则系统会崩溃,切记!

当下载了不同的代码,比如opencv库的时候,可能会面临切换python版本的问题,这个时候应该使用指令进行版本切换,使用如下指令:

sudo update-alternatives –install /usr/bin/python python /usr/bin/python2 100 
sudo update-alternatives –install /usr/bin/python python /usr/bin/python3 150

 当我们安装了Anaconda之后,想切换python版本,可以使用如下指令

sudo update-alternatives --config python

此时选择版本,然后就可以使用了!

猜你喜欢

转载自blog.csdn.net/qq_36470920/article/details/88598946
今日推荐