zoukankan      html  css  js  c++  java
  • ubuntu18.04 python版本切换

    update-alternatives是ubuntu系统中专门维护系统命令链接符的工具,通过它可以很方便的设置系统默认使用哪个命令、哪个软件版本,比如,我们在系统中同时安装了python2.7和python3.6两个版本,而我们又希望系统默认使用的是python3.6,那怎么办呢?通过update-alternatives就可以很方便的实现了。

    1.更新替代列表(管理员权限下)

    命令格式:update-alternatives --install <link> <name> <path> <priority>

    <link> is the symlink pointing to /etc/alternatives/<name>.
      (e.g. /usr/bin/pager)
    <name> is the master name for this link group.
      (e.g. pager)
    <path> is the location of one of the alternative target files.
      (e.g. /usr/bin/less)
    <priority> is an integer; options with higher numbers have higher priority in
      automatic mode.

     

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

    update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2

     

    2、查看替代列表:

    update-alternatives --list python

    3、切换:

    update-alternatives --config python

  • 相关阅读:
    linux常用命令
    PHP 魔术方法浅谈
    PHP常用的设计模式
    浅谈Restful
    进程,线程与协程的区别
    http与https的
    get与post的区别
    php连接数据库的两种方式
    DRF框架基本组件之过滤,搜索,排序
    DRF-JWT用户认证
  • 原文地址:https://www.cnblogs.com/jasonlixuetao/p/9729753.html
Copyright © 2011-2022 走看看