cenots升级python麻烦死了,6.4也不更新下版本,死在2.6.6了,真Y的蛋疼啊~~~

先升级Python,执行

wget http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz
tar zxvf Python-2.7.5.tgz
cd Python-2.7.5
./configure
make all
make install
make clean
make distclean

目前的路径应该是/usr/local/bin/python2.7,顺便看下版本

/usr/local/bin/python2.7 -V

然后查下当前的版本

python -V

我这里显示的是2.6.6

mv /usr/bin/python /usr/bin/python2.6.6
ln -s /usr/local/bin/python2.7 /usr/bin/python

现在再看下版本

python -V

应该显示2.7.5了吧

yum依赖修改

nano /usr/bin/yum

将头部的#!/usr/bin/python修改为#!/usr/bin/python2.6.6 即可.

安装setuptools

wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg --no-check-certificate
sh setuptools-0.6c11-py2.7.egg

可能胡出现问题:

执行sh setuptools-0.6c11-py2.7.egg,后 显示 can t decompress data zlib not available 错误,

进入python2.7的下载目录重新编译,./configure ,make all , make install

完后再执行sh setuptools-0.6c11-py2.7.egg ,完成egg安装。

安装pip

wget http://pypi.python.org/packages/source/p/pip/pip-1.0.2.tar.gz --no-check-certificate
tar zxf pip-1.0.2.tar.gz
cd pip-1.0.2
python setup.py install

不知道最近怎么回事,下载python的东西,必须加--no-check-certificate.....

现在,可以很方便的使用pip install安装东西,例如

pip install pelican
pip install Markdown


python2.7,报错如下:

Traceback (most recent call last):

 File "/usr/local/bin/pip", line 9, in

   load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()

 File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 378, in load_entry_point

 File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2566, in load_entry_point

 File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2260, in load

 File "/usr/local/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg/pip/__init__.py", line 10, in

   from pip.util import get_installed_distributions, get_prog

 File "/usr/local/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg/pip/util.py", line 17, in

   from pip.vendor.distlib import version

 File "/usr/local/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg/pip/vendor/distlib/version.py", line 13, in

   from .compat import string_types

 File "/usr/local/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg/pip/vendor/distlib/compat.py", line 31, in

   from urllib2 import (Request, urlopen, URLError, HTTPError,

ImportError: cannot import name HTTPSHandle


处理:yum安装openssl和openssl-devel。然后重新编译python。