博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
升级python到2.6.5
阅读量:7072 次
发布时间:2019-06-28

本文共 1699 字,大约阅读时间需要 5 分钟。

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

 

 
  1. File "setup.py", line 39  
  2. with open("ChangeLog""w"as changelog_file:  
  3. ^  
  4. SyntaxError: invalid syntax 

google后发现这个软件需要python2.6.5
centos5的自带python为2.4.3
下面是我升级的python的步骤
 
 
  1. wget http://mirrors.sohu.com/python/2.6.5/Python-2.6.5.tar.bz2  
  2. tar -jxvf Python-2.6.5.tar.bz2  
  3. cd Python-2.6.5  
  4. ./configure  
  5. make;make install 

测试

 

 
  1. [root@UNI-HEB-1-N015-bind-006 swift-1.3.0]# rm /usr/bin/python  
  2. rm: remove regular file `/usr/bin/python'? y  
  3. [root@UNI-HEB-1-N015-bind-006 swift-1.3.0]# ln /usr/local/bin/python2.6 /usr/bin/python  
  4. [root@UNI-HEB-1-N015-bind-006 swift-1.3.0]# python  
  5. Python 2.6.5 (r265:79063, Jun 29 2011, 12:30:49)  
  6. [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2  
  7. Type "help""copyright""credits" or "license" for more information.  
  8. >>> 
安装好了
不过在执行yum的时候,发现无法执行,
出现下面错误
 

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

 

改回来就好了

 

 
  1. [root@UNI-HEB-1-N015-bind-006 swift-1.3.0]# rm /usr/bin/python  
  2. rm: remove regular file `/usr/bin/python'? y  
  3. [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执行吧

     本文转自yifangyou 51CTO博客,原文链接:http://blog.51cto.com/yifangyou/617225,如需转载请自行联系原作者

你可能感兴趣的文章
Android的消息机制(1)
查看>>
树的创建与遍历
查看>>
进度条控件基本使用
查看>>
DataGrid PCV排序学习
查看>>
centos7安装jdk1.8
查看>>
Vue中v-for的数据分组
查看>>
实现选项卡的原理
查看>>
ajax 无刷新下拉加载更多。
查看>>
杭电 1287 破译密码
查看>>
mongodb集合的增删
查看>>
LeetCode 161: One Edit Distance
查看>>
SPOJ220 Relevant Phrases of Annihilation
查看>>
python基础学习10----集合
查看>>
ETL工具—Kettle数据的导入导出—批量Excel表到数据库
查看>>
知识思考
查看>>
OpenCV安装
查看>>
在一行上打印(完成度打印)
查看>>
linux运维人员常用的150个命令
查看>>
boost库 线程使用
查看>>
bzoj3068: 小白树
查看>>