ubuntu16.04中默认已经安装了python2.7和python3.5

hanli@ubuntu:/usr/bin$ ls |grep python
dh_python2
dh_python3
python
python2
python2.7
python2.7-config
python2-config
python3
python3.5
python3.5m
python3m
python-config
x86_64-linux-gnu-python2.7-config
x86_64-linux-gnu-python-config

怎么切换?

1.现在是2.7

hanli@ubuntu:/usr/bin$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)

2.执行两条命令

hanli@ubuntu:/usr/bin$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
update-alternatives: using /usr/bin/python2 to provide /usr/bin/python (python) in auto mode
hanli@ubuntu:/usr/bin$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150
update-alternatives: using /usr/bin/python3 to provide /usr/bin/python (python) in auto mode

3.再次查看已经变成3.5了

hanli@ubuntu:/usr/bin$ python
Python 3.5.2 (default, Nov 17 2016, 17:05:23)

4.怎么随意切换

hanli@ubuntu:/usr/bin$ sudo update-alternatives --config python
There are 2 choices for the alternative python (providing /usr/bin/python). Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/python3 150 auto mode
1 /usr/bin/python2 100 manual mode
2 /usr/bin/python3 150 manual mode Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/python2 to provide /usr/bin/python (python) in manual mode #数字前面有*号表示是当前使用版本,输入1切换到2.7,再次查看如下 hanli@ubuntu:/usr/bin$ sudo update-alternatives --config python
There are 2 choices for the alternative python (providing /usr/bin/python). Selection Path Priority Status
------------------------------------------------------------
0 /usr/bin/python3 150 auto mode
* 1 /usr/bin/python2 100 manual mode
2 /usr/bin/python3 150 manual mode Press <enter> to keep the current choice[*], or type selection number:

ubuntu16.04同时使用 pyhton2.7和3.5,并随意切换的更多相关文章

  1. Ubuntu16.04多个版本GCC编译器的安装和切换

    这几天在配置交叉编译ARM开发板的linux内核的过程中碰到了很多问题,其中包括了GCC版本太高等问题,由此我打算安装其他老的版本给我的Ubuntu16.04.实验过程如下: 官网的教程是最牛逼的,先 ...

  2. Ubuntu16.04多个版本GCC编译器的安装和切换【转】

    本文转载自:https://www.cnblogs.com/uestc-mm/p/7511063.html 这几天在配置交叉编译ARM开发板的linux内核的过程中碰到了很多问题,其中包括了GCC版本 ...

  3. ubuntu16.04 桌面图标左侧,右侧,底部进行切换

    转载:https://jingyan.baidu.com/article/e52e36154e6af340c60c518c.html 传统的 Unity 桌面环境,其应用程序启动器的容器——Launc ...

  4. Ubuntu16.04下的modules模块编译加载

    一.首先编写对应的驱动程序的相关内容:(最简单的hello.c程序) #include<linux/init.h> #include<linux/module.h> MODUL ...

  5. 使用win10远程控制ubuntu16.04

    使用win10远程控制ubuntu16.04,网上很多需要安装xfce桌面的.今天介绍一下,不需要安装其他桌面,使用Ubuntu16.04自带桌面,漂亮美观. Ubuntu16.04端: 1.打开终端 ...

  6. Ubuntu16.04 LTS下apt安装WireShark

    Ubuntu16.04 LTS下apt安装WireShark 安装与配置 首先通过apt安装WireShark: $ sudo apt install wireshark 会同时安装许多的依赖包,其中 ...

  7. ubuntu16.04配置py-faster-rcnn

    在ubuntu16.04下编译安装了py-faster-rcnn. 主要步骤包括:安装cuda/cudnn,换apt源,装开源显卡驱动,装caffe依赖的apt包和python包,下载py-faste ...

  8. Elasticsearch-5.0.0移植到ubuntu16.04

    旧环境: windows10 elasticsearch-5.0.0(含elasticsearch-head插件) 新环境: ubuntu16.04 由于环境换成了ubuntu,之前windows10 ...

  9. 【.net core 跨平台】第一步 在Ubuntu16.04 配置.net core环境

    本次使用VMware10.0.4工具安装Ubuntu16.04系统并配置.net core环境   Ubuntu 16.04 desktop下载地址:http://releases.ubuntu.co ...

随机推荐

  1. 【LeetCode】647. Palindromic Substrings 解题报告(Python)

    [LeetCode]647. Palindromic Substrings 解题报告(Python) 标签: LeetCode 题目地址:https://leetcode.com/problems/p ...

  2. 【LeetCode】148. Sort List 解题报告(Python & C++)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.c ...

  3. Oracle VirtualBox 配置宿主机与虚拟机互访

    写作原因 之前经常使用 VMware Workstation Pro,由于是非正常付费使用的不打算再用了.替代品就是 Oracle VirtualBox,但是发现了一个问题: "我想用NAT ...

  4. 一个简单的js时钟

    演示地址 代码 <html> <head> <title> Nonove js clock 时钟 </title> <script type=&q ...

  5. CapstoneCS5265|TYPEC转HDMI 4K60HZ转换方案设计|CS5265功能介绍

    芯片简介描述:CS5265集成了一个DP1.4的转换器HDMI2.0转换.此外,CC控制器还用于CC通信,以实现DP Alt模式. CS5265是一种高度集成的单芯片,适用于多个细分市场和显示应用,如 ...

  6. 编写Java程序,实现对兵营类的封装,将兵营类中的所有属性设置为私有访问权限,方法设置为公有访问权限

    返回本章节 返回作业目录 需求说明: 实现对兵营类的封装 将兵营类中的所有属性设置为私有访问权限. 将兵营类中所有属性的赋值方法设置为公有访问权限. 要求兵营名称的长度在4-8位之间. 要求兵营士兵的 ...

  7. 编写Java程序,实现控制台版的省市联动

    返回本章节 返回作业目录 需求说明: 系统显示用户所有直辖市的名称,用户在控制台输入直辖市的名称,即可在控制台中显示该直辖市所管辖的所有区的名称. 实现思路: 创建省市联动类ProvincialLin ...

  8. Ranger-Usersync安装

    Ranger-Usersync安装, 配置数据源Unix,Usersync从Unix拉取Users/Groups的数据源, 对应的Ranger版本0.6.0. IP/机器名 安装软件 运行进程 zdh ...

  9. .net core中Grpc使用报错:The response ended prematurely.

    当我们调用Grpc是出现下面的一堆异常时,一般是由于LTS导致的: Call failed with gRPC error status. Status code: 'Unavailable', Me ...

  10. 基于机器学习和TFIDF的情感分类算法,详解自然语言处理

    摘要:这篇文章将详细讲解自然语言处理过程,基于机器学习和TFIDF的情感分类算法,并进行了各种分类算法(SVM.RF.LR.Boosting)对比 本文分享自华为云社区<[Python人工智能] ...