首页 > 系统相关 >ubuntu 默认python版本切换

ubuntu 默认python版本切换

时间:2023-08-04 09:45:11浏览次数:46  
标签:bin python alternatives update 默认 -- usr ubuntu

Ubuntu下完美切换Python版,即设置系统默认的python版本(亲测有效)_ubuntu 切换python版本_关彼得的博客-CSDN博客

 

sudo su
update-alternatives --list python

update-alternatives: error: no alternatives for python

update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
#update-alternatives: using /usr/bin/python2.7 to provide /usr/bin/python (python) in auto mode
update-alternatives --install /usr/bin/python python /usr/bin/python3.5 2
#update-alternatives: using /usr/bin/python3.4 to provide /usr/bin/python (python) in auto mode

update-alternatives --list python
#/usr/bin/python2.7
#/usr/bin/python3.5

update-alternatives --config python

选择数字就会更改默认python版本

标签:bin,python,alternatives,update,默认,--,usr,ubuntu
From: https://www.cnblogs.com/WenJXUST/p/17605065.html

相关文章

  • 盘点一个初学者Python库安装的问题(Mac系统)(下篇
    大家好,我是皮皮。一、前言前几天在Python私教群【Emma】问了一个Python库安装的基础问题,一起来看看吧。上一篇文章讲到【Emma】的远程环境不给力,需要继续本地指导。二、实现过程针对导包失败的问题,这里【狂吃山楂片】给了一个解决方法,如下图所示:右下角可以设置环境,你点一下,......
  • python + mysql
    1.连接mysql数据库,基本数据查询流程#1.连接conn=pymysql.connect(host='127.0.0.1',port=3306,user='root',password='',db='db8',charset='utf8')#2.创建游标cursor=conn.cursor()#注意%s需要加引号sql="select*fromu......
  • 【备考实战】计算机二级Python刷题【一】
    时间报名时间:2023-8-31考试时间:2023-9-23第1题计算机完成一条指令所花费的时间称为一个A.执行时序B.存取周期C.执行速度D.指令周期参考解析参考解析:D[解析]一般把计算机完成一条指令所花费的时间称为-一个指令周期。指令周期越短,指令执行就越快。本题答案为D选项......
  • Python用RNN神经网络:LSTM、GRU、回归和ARIMA对COVID19新冠疫情人数时间序列预测|附代
    全文下载链接: http://tecdat.cn/?p=27042最近我们被客户要求撰写关于新冠疫情的研究报告,包括一些图形和统计输出。在本文中,该数据根据世界各国提供的新病例数据提供。获取时间序列数据  df=pd.read_csv("C://global.csv")探索数据此表中的数据以累积的形式呈现,为了......
  • vscode snnipet of python
    {//Placeyoursnippetsforpythonhere.Eachsnippetisdefinedunderasnippetnameandhasaprefix,bodyand//description.Theprefixiswhatisusedtotriggerthesnippetandthebodywillbeexpandedandinserted.Possiblevariablesare://$1,......
  • Python 优化第一步: 性能分析实践 使用cporfile+gprof2dot可视化
    拿来主义:python-mcProfile-oprofile.pstatsto_profile.pygprof2dot-fpstatsprofile.pstats|dot-Tpng-oclick.png然后顺着浅色线条优化就OK了。 windows下:google下graphviz-2.38.msi,然后安装。dot命令需要。gitclone https://github.com/jrfonseca/gprof2dot.git......
  • python 闭包变量不允许write,要使用nonlocal
     以下是一段简单的闭包代码示例:deffoo():m=3n=5defbar():a=4returnm+n+areturnbar>>>bar=foo()>>>bar()12是可以的!但是:deffoo():m=3n=5defbar():a=4m+=1#不可以!!!return......
  • python 代码混淆工具汇总
    pyminifierPyminifierisaPythoncodeminifier,obfuscator,andcompressor.NoteForthelatest,completedocumentation:http://liftoff.github.io/pyminifier/Forthelatestcode:https://github.com/liftoff/pyminifierOverviewWhenyouinstallpyminifierit......
  • ubuntu的docker相关操作指令
    daemon启动docker服务以及停止systemctlstartdockersystemctlstopdockersystemctlstatusdockerdocker的镜像相关操作#查看本地镜像dockerimages#搜索镜像dockersearchredis#下载镜像,不写版本号,默认是latestdockerpullredis:3.2#删除镜像dockerrmi<docker......
  • Python安装与配置
    一、Windows下安装Python3。官网地址:https://www.python.org/下载地址:https://www.python.org/ftp/python/3.6.4/python-3.6.4-amd64.exe二、安装1、为了不去设置环境变量,我选择Customizeinstallation安装,并且勾选AddPython3.6toPATH。   2、选择安装路径,我安装......