centos6.x之python2.6升级为2.7
centos6.x开始升级为2.7 :
yum -y install gcc zlib zlib-devel python-devel libffi-devel openssl openssl-devel wget https://www.python.org/ftp/python/2.7.14/Python-2.7.14.tgz tar -xvf Python-2.7.14.tgz cd Python-2.7.14 ./configure --prefix=/opt/python2.7 --with-ssl make && make install mv /usr/bin/python /usr/bin/python.2.6 rm -f /usr/bin/python-config ln -s /opt/python2.7/bin/python /usr/bin/python ln -s /opt/python2.7/bin/python-config /usr/bin/python-config ln -s /opt/python2.7/include/python2.7/ /usr/include/python2.7 wget https://bootstrap.pypa.io/get-pip.py python get-pip.py ln -s /opt/python2.7/bin/pip2.7 /usr/bin/pip2.7 sed -i "s/bin\/python/bin\/python2.6/g" /usr/bin/yum ln -s /opt/python2.7/bin/easy_install /usr/bin/easy_install
注: 不要忘记修改yum 值否则会报什么module 的错误
vim /usr/bin/yum
#!/usr/bin/python2.6
注意使用 pip2.7 而不是pip 执行
其它问题:
错误1:
File "setup_posix.py", line 25, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
解决方法: ln -s /opt/mysql/bin/mysql_config /usr/bin/mysql_config
pip2.7 install MySQL-python