dinghongkai

 

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         手动模式

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

 

分类:

技术点:

相关文章:

  • 2021-10-26
  • 2022-01-03
  • 2021-10-09
  • 2022-12-23
  • 2021-10-05
  • 2021-07-26
  • 2021-11-27
猜你喜欢
  • 2022-01-07
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2021-07-11
  • 2021-07-01
  • 2021-10-19
相关资源
相似解决方案