前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >升级python到2.6.5

升级python到2.6.5

作者头像
py3study
发布2020-01-13 11:02:38
6520
发布2020-01-13 11:02:38
举报
文章被收录于专栏:python3

今天需要安装一个软件时,发现系统的python版本太低,出现下面的错误:

代码语言:javascript
复制
File "setup.py", line 39  with open("ChangeLog", "w") as changelog_file:  ^  SyntaxError: invalid syntax 

google后发现这个软件需要python2.6.5

centos5的自带python为2.4.3

下面是我升级的python的步骤

代码语言:javascript
复制
wget http://mirrors.sohu.com/python/2.6.5/Python-2.6.5.tar.bz2  tar -jxvf Python-2.6.5.tar.bz2  cd Python-2.6.5  ./configure  make;make install 

测试

代码语言:javascript
复制
[root@UNI-HEB-1-N015-bind-006 swift-1.3.0]# rm /usr/bin/python  rm: remove regular file `/usr/bin/python'? y  [root@UNI-HEB-1-N015-bind-006 swift-1.3.0]# ln /usr/local/bin/python2.6 /usr/bin/python  [root@UNI-HEB-1-N015-bind-006 swift-1.3.0]# python  Python 2.6.5 (r265:79063, Jun 29 2011, 12:30:49)  [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2  Type "help", "copyright", "credits" or "license" for more information.  >>> 

安装好了

不过在执行yum的时候,发现无法执行,

出现下面错误

代码语言:javascript
复制
[root@UNI-HEB-1-N015-bind-006 swift-1.3.0]# yum search apt  There was a problem importing one of the Python modules  required to run yum. The error leading to this problem was:  No module named yum  Please install a package which provides this module, or  verify that the module is installed correctly.  It's possible that the above module doesn't match the  current version of Python, which is:  2.6.5 (r265:79063, Jun 29 2011, 12:30:49)  [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]  If you cannot solve this problem yourself, please go to  the yum faq at:  http://wiki.linux.duke.edu/YumFaq 

改回来就好了

代码语言:javascript
复制
[root@UNI-HEB-1-N015-bind-006 swift-1.3.0]# rm /usr/bin/python  rm: remove regular file `/usr/bin/python'? y  [root@UNI-HEB-1-N015-bind-006 swift-1.3.0]# ln -s /usr/bin/python2.4 /usr/bin/python 

这个问题暂时未解决,大家先用/usr/local/bin/python2.6执行吧

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019/08/12 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档