更新CentOS lib庫文件
python
yum -y update
安裝開發工具包
git
yum groupinstall -y development
安裝擴展包
github
yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel
下載Python2.7.6
sql
wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
解壓Python2.7.6
python2.7
tar -xvf Python-2.7.6.tar.xz
進入Python2.7.6目錄
curl
cd Python-2.7.6
編譯安裝Python2.7.6
scrapy
./configure
make && make altinstall
將老的Python程序進行備份
工具
mv /usr/bin/python /usr/bin/python2.6.6
創建新的Python連接
開發工具
ln -s /usr/local/bin/python2.7 /usr/bin/python
修改/usr/bin/yum文件
url
vi /usr/bin/yum
將第一行的 #!/usr/bin/python 改成 #!/usr/bin/python2.6.6
下載setuptools
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz
解壓setuptools
tar -xvf setuptools-1.4.2.tar.gz
進入setuptools目錄
cd setuptools-1.4.2
經過已安裝的Python2.7.6安裝setuptools
python setup.py install
安裝 pip
easy_install pip
curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python2.7 -
yum install libxslt-devel
pip install scrapy