(转)Linux Centos7 升级python2至python3 - 依然范儿特西的文章 - 知乎 https://zhuanlan.zhihu.com/p/33660059

1 查看python 版本

python -V

2 查看软连接指向

ls -al /usr/bin/python

3 重命名软连接

mv /usr/bin/python /usr/bin/python2.7.5

4 下载并解压 python

wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
tar -xf Python-3.6.4.tgz

5 安装python

cd Python-3.6.4
./configure
make
make install

到此,python3.6.4 已经安装到系统里了。 python2.7.5 由于软连接被重命名了。所以。你查看python 版本时候。会不存在。。

命令 : python -V
结果: -bash: /usr/bin/python: No such file or directory

如果带上刚才重命名的软连接即可使用

6 让系统默认使用Python 3.6.4

由于软连接指向被修改。此时 yum不能使用。需编辑一下 yum 的配置文件

vi /usr/bin/yum

把文件头部的

#!/usr/bin/python

改成

#!/usr/bin/python2.7.5

保存退出即可!

7 建立新的链接

rm -rf /usr/bin/python
rm -rf /usr/bin/py
ln -s /usr/local/bin/python3.6 /usr/bin/python

8 验证是否成功

python -V

centos7 python2.7.5 升级python3.6.4的更多相关文章

  1. python环境搭建-Linux系统下python2.6.6升级python3.5.2步骤

    [root@template ~]# python -v # /usr/lib64/python2.6/encodings/utf_8.pyc matches /usr/lib64/python2.6 ...

  2. Linux下Python2升级Python3

    Linux下Python2的升级方法: 一.下载Python3安装包: 1.在线下载 wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2 ...

  3. 转载: Centos7 升级python3,解决升级后不兼容问题

    Centos7配置更新国内yum源 http://blog.csdn.net/qingguiyu/article/details/50721956 Centos7 升级python3,解决升级后不兼容 ...

  4. ubuntu下卸载python2和升级python3.5

    卸载python只需一条语句就可以实现 sudu apt-get remove python ubuntu下安装python3 sudo apt-get install python3 但这样只安装了 ...

  5. Mac OS X10.9安装的Python2.7升级Python3.4步骤详解

    Mac OS X10.9安装的Python2.7升级Python3.4步骤详解 Mac OS X10.9默认带了Python2.7,不过现在Python3.4.0出来了,如果想使用最新版本,赶紧升级下 ...

  6. python2升级python3

    需求: centos环境,python2.7需要升级为python3.x 1.请先手动(再次)安装 openssl .否则你升级之后,你的pip不能下载,会各种报错的. 比如这种错误: ImportE ...

  7. ubuntu Python2 升级Python3

    今天买了一台阿里的服务器, 想搭建一个爬虫, 但是 服务器是python2的, 需要升级到python3 1. 下载python3的包 wget https://www.python.org/ftp/ ...

  8. CentOS7 升级 python3 过程及注意

    • 从官网下载python3的压缩包,解压(以3.5.1版本为例)• 创建安装目录(自定义)sudo mkdir /usr/local/python3• cd 进入解压目录sudo ./configu ...

  9. Centos 7 x86_64 环境Python2.7升级Python3.7.4

    升级Python3.7.4 #安装补丁包yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel read ...

随机推荐

  1. sql语句查询知识点

    LEFT JOIN    关键字会从左表 (Persons) 那里返回所有的行,即使在右表 (Orders) 中没有匹配的行 INNER JOIN   INNER JOIN 关键字在表中存在至少一个匹 ...

  2. 【转】Linux下RabbitMQ服务器搭建(单实例)

    阅读目录 系统环境 安装步骤 注意事项 参考资料 回到顶部 系统环境 操作系统:CentOS6.9 erlang:OTP 19.3 rabbitmq:rabbitmq-server 3.6.12 回到 ...

  3. week9:Recommender Systems

    Collaborative  filtering 的原理不是很理解? xi   是每一步电影的特征向量,表示浪漫/动作

  4. ArcMap中用python的split方法提取字段的值

    提取PROPERTY_L字段空格分隔符前面的地址编号 提取前:5105 ABERDEEN LANE 提取后:5105 提取的表达式:!PROPERTY_L!.split(" ")[ ...

  5. [微信小程序] js变量名称写活

    function create_variable(num){ var name = "test_"+num; //生成函数名 window[name] = 100; window[ ...

  6. BUAA OO 2019 第二单元作业总结

    目录 总 架构 controller model view 优化算法 Look 算法 多种算法取优 预测未来 多线程 第五次作业 第六次作业 第七次作业 代码静态分析 UML 类图 类复杂度 类总代码 ...

  7. A - Chess Placing CodeForces - 985A

    You are given a chessboard of size 1 × n. It is guaranteed that n is even. The chessboard is painted ...

  8. 16JavaScript for循环

    1.JavaScript 循环 如果希望一遍又一遍地运行相同的代码,并且每次的值都不同,那么使用循环是很方便的. 我们可以这样输出数组的值: 一般写法: document.write(cars[0] ...

  9. 微信小程序 微信支付

    微信小程序前端自处理: //时间戳 timeStamp() { return parseInt(new Date().getTime() / 1000) + '' }, //随机数 randomStr ...

  10. 和IDEA一样好用的go语言IDE:Goland

    因为IDEA和Goland来自同一家非常有名的捷克公司:JetBrains 很好用,智能化程度高 最新版下载地址:http://www.jetbrains.com/go/?fromMenu 相关使用手 ...