Centos installs the default python2.6 upgrade to python2.7, and solves various problems of python toolkit installation.
Idea guide: Upgrade 2.7 can not use yum to install python toolkit. Suggest using pip
yum -y update
yum groupinstall -y 'development tools'
yum install -y zlib-devel bzip2-devel openssl-devel xz-libs wget gcc
wget http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz
tar -xvf Python-2.7.8.tar.xz
cd Python-2.7.8
. /configure --prefix=/usr/local/
make
make install
[ root@dbmasterxxx ~]# python2.7 -V
Python 2.7.8
mv /usr/bin/python /usr/bin/python2.6
ln -s /usr/local/bin/python2.7 /usr/bin/python
[ root@dbmasterxxx ~]# python -V
Python 2.7.8
You cannot use yum to install the python module after upgrading to 2.7, because yum will install the module into python2.6 by default.
So use pip to install the python module. Therefore, pip needs to be installed in the new 2.7.
5.1 pip installation steps (pip uses source code installation, because yum installation will be installed to 2.6)
wget --no-check-certificate https://github.com/pypa/pip/archive/1.5.5.tar.gz
tar zvxf 1.5.5.tar.gz #Unzip the file
cd pip-1.5.5/
python setup.py install
5.2 Delete the original pip and create a 2.7 pip
rm -rf /usr/bin/pip
ln /usr/local/bin/pip /usr/bin/pip
5.3 If you cannot install pip, install the setuptools package first
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
tar zxvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
python setup.py build
python setup.py install
pip install DjangoCaptcha
Recommended Posts