升级python到2.6.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,如需转载请自行联系原作者


相关文章
|
7月前
|
安全 Python
Mac Python升级
Mac Python升级
48 0
|
7月前
|
Ubuntu Python
百度搜索:蓝易云【ubuntu16.04升级python3.7.1教程】
现在您已经成功升级到Python 3.7.1。请注意,这仅适用于Ubuntu 16.04,如果您使用的是其他版本的Ubuntu或不同的操作系统,请查阅相应的文档或指南进行操作。
193 0
|
9月前
|
Java Linux Shell
centos7内网离线安装face_recognition、python、pip、CMake、dlib,离线升级gcc/切换gcc,文末有face_recognition的docker版本
公司项目需要人脸识别,本来app自带人脸识别,结果api支持的设备试了一圈就一个同事的华为Mate40Pro可以,所以使用无望。接着找了一下免费的java离线人脸识别sdk,发现虹软的确实简单好用,一会就在linux上弄好并测试通过了,然而在准备集成进去开写代码时,不小心看到了一眼首次激活需联网,后续方可离线使用,好吧,我们内网机器首次都不可能的,接着看了下离线激活方法,首先需要企业认证,这一步我们肯定没法做的,毕竟不是之前的小公司了,营业执照啥的随便给我肯定不行,直接放弃了。后来在同事推荐下看了下face_recognition这个项目,之前基本没用过python,于是有了漫长的踩坑之旅。
350 1
|
4月前
|
数据采集 文字识别 Python
介绍一个打怪升级练习Python的网站,寓教于乐了属于是!
介绍一个打怪升级练习Python的网站,寓教于乐了属于是!
|
5月前
|
缓存 Unix Linux
尝试安装或升级Python包时,由于设备上没有足够的空间而导致的错误
尝试安装或升级Python包时,由于设备上没有足够的空间而导致的错误
94 4
|
8月前
|
Linux Python
centos7使用源码从python2升级到python3,干货值得收藏
centos7使用源码从python2升级到python3,干货值得收藏
124 0
|
9月前
|
Python
python环境部署:pip升级命令错误的解决方案
python环境部署:pip升级命令错误的解决方案
113 0
|
9月前
|
XML 安全 Unix
Python3.7升级Python3.8(Python3.8新特性调研)
Python3.7升级Python3.8(Python3.8新特性调研)
276 0
|
10月前
|
存储 索引 Python
把你的 Python 技能从 “Hello World“ 升级到 “万能钥匙“:掌握 Python 的输出、输入、数据类型转换和运算符!
把你的 Python 技能从 “Hello World“ 升级到 “万能钥匙“:掌握 Python 的输出、输入、数据类型转换和运算符!
把你的 Python 技能从 “Hello World“ 升级到 “万能钥匙“:掌握 Python 的输出、输入、数据类型转换和运算符!
|
11月前
|
TensorFlow 算法框架/工具 Python
Python升级tensorflow2.x版本相关问题:No module named ‘tensorflow.contrib‘ 问题解决
Python升级tensorflow2.x版本相关问题:No module named ‘tensorflow.contrib‘ 问题解决
219 0

热门文章

最新文章