ubuntu16.04同时使用 pyhton2.7和3.5,并随意切换
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,并随意切换的更多相关文章
- Ubuntu16.04多个版本GCC编译器的安装和切换
这几天在配置交叉编译ARM开发板的linux内核的过程中碰到了很多问题,其中包括了GCC版本太高等问题,由此我打算安装其他老的版本给我的Ubuntu16.04.实验过程如下: 官网的教程是最牛逼的,先 ...
- Ubuntu16.04多个版本GCC编译器的安装和切换【转】
本文转载自:https://www.cnblogs.com/uestc-mm/p/7511063.html 这几天在配置交叉编译ARM开发板的linux内核的过程中碰到了很多问题,其中包括了GCC版本 ...
- ubuntu16.04 桌面图标左侧,右侧,底部进行切换
转载:https://jingyan.baidu.com/article/e52e36154e6af340c60c518c.html 传统的 Unity 桌面环境,其应用程序启动器的容器——Launc ...
- Ubuntu16.04下的modules模块编译加载
一.首先编写对应的驱动程序的相关内容:(最简单的hello.c程序) #include<linux/init.h> #include<linux/module.h> MODUL ...
- 使用win10远程控制ubuntu16.04
使用win10远程控制ubuntu16.04,网上很多需要安装xfce桌面的.今天介绍一下,不需要安装其他桌面,使用Ubuntu16.04自带桌面,漂亮美观. Ubuntu16.04端: 1.打开终端 ...
- Ubuntu16.04 LTS下apt安装WireShark
Ubuntu16.04 LTS下apt安装WireShark 安装与配置 首先通过apt安装WireShark: $ sudo apt install wireshark 会同时安装许多的依赖包,其中 ...
- ubuntu16.04配置py-faster-rcnn
在ubuntu16.04下编译安装了py-faster-rcnn. 主要步骤包括:安装cuda/cudnn,换apt源,装开源显卡驱动,装caffe依赖的apt包和python包,下载py-faste ...
- Elasticsearch-5.0.0移植到ubuntu16.04
旧环境: windows10 elasticsearch-5.0.0(含elasticsearch-head插件) 新环境: ubuntu16.04 由于环境换成了ubuntu,之前windows10 ...
- 【.net core 跨平台】第一步 在Ubuntu16.04 配置.net core环境
本次使用VMware10.0.4工具安装Ubuntu16.04系统并配置.net core环境 Ubuntu 16.04 desktop下载地址:http://releases.ubuntu.co ...
随机推荐
- JAVA从字符串中提取纯数字
/** * 从字符串中提取纯数字 * @param str * @return */ public static String getNumeric(String str) { String regE ...
- Android 崩溃错误
SIGSEGV ---段错误. 遇到此错误的可能情况是: 1.缓冲区溢出---通常由指针引用超出范围引起. 2.堆栈溢出---请记住默认堆栈大小为8192K. 3.我们的判断系统禁止文件访问---文件 ...
- 【LeetCode】383. Ransom Note 解题报告(Java & Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 Java解法 Python解法 日期 [LeetCo ...
- 1033 - Generating Palindromes
1033 - Generating Palindromes PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit ...
- MySQL与Oracle 差异比较之二函数
函数 编号 类别 ORACLE MYSQL 注释 1 数字函数 round(1.23456,4) round(1.23456,4) 一样:ORACLE:select round(1.23456,4) ...
- $\infty$-former: Infinite Memory Transformer
目录 概 主要内容 如何扩展? 实验细节 Martins P., Marinho Z. and Martins A. \(\infty\)-former: Infinite Memory Transf ...
- electron串口通信使用serialport安装报错
1.报错信息没有安装python环境 1 gyp ERR! find Python 2 gyp ERR! find Python Python is not set from command line ...
- C# .net 环境下使用rabbitmq消息队列
消息队列的地位越来越重要,几乎是面试的必问问题了,不会使用几种消息队列都显得尴尬,正好本文使用C#来带你认识rabbitmq消息队列 首先,我们要安装rabbitmq,当然,如果有现成的,也可以使用, ...
- Python 使用timeit模块计算时间复杂度时系统报“invalid syntax”错误
最近在看算法相关的文档 在时间复杂度环节 遇到一个实例: 导入timeit模块后,通过Timer定时器计算两种不同处理方法的时间复杂度 错误代码及报错如下图所示: 仔细查阅 发现from__main_ ...
- python的赋值、浅拷贝和深拷贝
""" 一.赋值在python中就是简单的对象引用 """ list_a = ["aaa", "bbb&quo ...