Centos6.4上python2.6.6升级到2.7.6
2015-02-14 22:35
267 查看
好久不写博文了,本文没什么含金量,只是做一个记录。便于日后翻阅。
0.操作系统信息
[vagrant@localhost ~]$ cat /etc/issue
CentOS release 6.4 (Final)
Kernel \r on an \m
1.当前python版本信息
[vagrant@localhost bin]$ pwd
/usr/bin
[vagrant@localhost bin]$ ll -a python
-rwxr-xr-x. 2 root root 4864 2月 22 2013 python
[vagrant@localhost bin]$ python
Python 2.6.6 (r266:84292, Feb 22 2013, 00:00:18)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
2.删掉当前python
[vagrant@localhost bin]$ sudo rm -rf python
3.下载且安装2.7.6安装包
[vagrant@localhost download]$ ll Python-2.7.6.tgz
-rw-r--r-- 1 vagrant vagrant 14725931 5月 14 2014
Python-2.7.6.tgz
[vagrant@localhost Python-2.7.6]$ ./configure && make && sudo make install
4.制作软连接把python2.7.6指向python
[vagrant@localhost bin]$ sudo ln -s /usr/local/bin/python2.7 python
[vagrant@localhost bin]$ pwd
/usr/bin
[vagrant@localhost bin]$ ll python
lrwxrwxrwx 1 root root 24 2月 14 14:29 python ->/usr/local/bin/python2.7
ok,现在的python环境切换成2.7.6了。
[vagrant@localhost ~]$ python
Python 2.7.6 (default, Feb 14 2015, 14:13:13)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
python是升级成功了,可是yum不能使用了。。。
[vagrant@localhost webservice]$ yum
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.7.6 (default, Feb 14 2015, 14:13:13)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
找不到yum模块了
解决方法:
[vagrant@localhost webservice]$ vi /usr/bin/yum
编辑第一行
#!/usr/bin/python
import sys
try:
改成如下(原python版本是2.6)
#!/usr/bin/python2.6
import sys
try:
这些yum正常了
[vagrant@localhost webservice]$ yum --version
3.2.29
Installed: rpm-4.8.0-32.el6.x86_64 at 2013-11-03 07:59
Built : CentOS BuildSystem <http://bugs.centos.org> at 2013-02-22 02:13
Committed: Florian Festi <ffesti@redhat.com> at 2012-11-15
Installed: yum-3.2.29-40.el6.centos.noarch at 2013-11-03 07:59
Built : CentOS BuildSystem <http://bugs.centos.org> at 2013-02-22 11:26
Committed: Johnny Hughes <johnny@centos.org> at 2013-02-21
Installed: yum-plugin-fastestmirror-1.1.30-14.el6.noarch at 2013-11-03 07:59
Built : CentOS BuildSystem <http://bugs.centos.org> at 2012-06-22 12:23
Committed: Zdenek Pavlas <zpavlas@redhat.com> at 2012-04-26
参考:http://see.sl088.com/wiki/Centos5_升级Python
0.操作系统信息
[vagrant@localhost ~]$ cat /etc/issue
CentOS release 6.4 (Final)
Kernel \r on an \m
1.当前python版本信息
[vagrant@localhost bin]$ pwd
/usr/bin
[vagrant@localhost bin]$ ll -a python
-rwxr-xr-x. 2 root root 4864 2月 22 2013 python
[vagrant@localhost bin]$ python
Python 2.6.6 (r266:84292, Feb 22 2013, 00:00:18)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
2.删掉当前python
[vagrant@localhost bin]$ sudo rm -rf python
3.下载且安装2.7.6安装包
[vagrant@localhost download]$ ll Python-2.7.6.tgz
-rw-r--r-- 1 vagrant vagrant 14725931 5月 14 2014
Python-2.7.6.tgz
[vagrant@localhost Python-2.7.6]$ ./configure && make && sudo make install
4.制作软连接把python2.7.6指向python
[vagrant@localhost bin]$ sudo ln -s /usr/local/bin/python2.7 python
[vagrant@localhost bin]$ pwd
/usr/bin
[vagrant@localhost bin]$ ll python
lrwxrwxrwx 1 root root 24 2月 14 14:29 python ->/usr/local/bin/python2.7
ok,现在的python环境切换成2.7.6了。
[vagrant@localhost ~]$ python
Python 2.7.6 (default, Feb 14 2015, 14:13:13)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
python是升级成功了,可是yum不能使用了。。。
[vagrant@localhost webservice]$ yum
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.7.6 (default, Feb 14 2015, 14:13:13)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
找不到yum模块了
解决方法:
[vagrant@localhost webservice]$ vi /usr/bin/yum
编辑第一行
#!/usr/bin/python
import sys
try:
改成如下(原python版本是2.6)
#!/usr/bin/python2.6
import sys
try:
这些yum正常了
[vagrant@localhost webservice]$ yum --version
3.2.29
Installed: rpm-4.8.0-32.el6.x86_64 at 2013-11-03 07:59
Built : CentOS BuildSystem <http://bugs.centos.org> at 2013-02-22 02:13
Committed: Florian Festi <ffesti@redhat.com> at 2012-11-15
Installed: yum-3.2.29-40.el6.centos.noarch at 2013-11-03 07:59
Built : CentOS BuildSystem <http://bugs.centos.org> at 2013-02-22 11:26
Committed: Johnny Hughes <johnny@centos.org> at 2013-02-21
Installed: yum-plugin-fastestmirror-1.1.30-14.el6.noarch at 2013-11-03 07:59
Built : CentOS BuildSystem <http://bugs.centos.org> at 2012-06-22 12:23
Committed: Zdenek Pavlas <zpavlas@redhat.com> at 2012-04-26
参考:http://see.sl088.com/wiki/Centos5_升级Python
相关文章推荐
- Centos 6.4 python 2.6.6 升级到 2.7.6
- centos6.5下python2.6.6版本升级Python2.7.6安装过程
- CentOS环境 升级Python2.6.6至2.7.6
- CentOS环境 升级Python2.6.6至2.7.5
- centos 6.4x64 django开发环境搭建(升级python2.6.6为2.7.3)
- CentOS6.4升级python2.6.6到3.4.3
- CentOS 6.3 64bit上升级系统默认Python 2.6.6到2.7.10版本
- Centos 5.5 python 2.4升级python 2.6.6
- Centos 6.4 python 2.6.6 升级到 2.7.3
- centOS 6.5 升级python到2.7.6
- centos升级python(从2.6.6升级到2.7.8)
- 升级Python2.6.6至2.7.5
- 升级python 到2.7.6版本
- CentOS环境 升级Python2.6.6至2.7.5
- centos 6.5 升级python到python 2.7.6出现的问题及解决方法汇总[经常更新]
- CentOS6.4升级python2.7.6
- CentOS6.4升级python2.6.6到3.3.0
- redhat 升级Python到2.7.6
- python2.7.6比python2.7.3升级过程中import module问题及解决方法
- RHEL6.4上升级python从2.6.6到2.7.3