首页 > 编程语言 > 详细

ubuntu python 版本管理

时间:2019-06-23 16:41:37      阅读:98      评论:0      收藏:0      [点我收藏+]

 

ubuntu 命令行查看 python 目录

$ whereis python # 显示所有得到 python 目录

$ which python  # 显示默认的 python 解释器目录

$ which python3.7  # 显示 python3.7 版本的解释器目录

 

update-alternatives 版本管理

$ update-alternatives --help 查看所有的命令和参数,常用的命令有:

  • update-alternatives --install  <link>  <name>  <path>  :add a group of a alternatives to the system
  • update-alternatives --config  <name> :show alternatives for the <name> group and ask the user to select which one to use
  • update-alternatives --remove <name> <path> :remove <path> from the <name> group alternatives

 

$ update-alternatives --list python

出现错误 update-alternatives: error: no alternatives for python,首先需要创建 python 组,增加可选项,如:

$ update-alternatives --install /usr/bin/python python /usr/bin/python2.7

$ update-alternatives  --install /usr/bin/python python /usr/bin/python3.5

 

$ update-alternatives  --config python

  选择                 路径           优先级        状态
------------------------------------------------------------
* 0            /usr/bin/python2.7     2         自动模式
  1            /usr/bin/python2.7     2         手动模式
  2            /usr/bin/python3.5     1         手动模式

自动模式:
自动选择优先级最高的路径为默认路径(数字越大,表示优先级越高)
手动模式:手动选择序号为默认路径

 

ubuntu python 版本管理

原文:https://www.cnblogs.com/dinghongkai/p/11073137.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!