centos下安装色彩scrapy
一、安装Python2.7.6
-
更新CentOS lib库文件
yum -y update
-
安装开发工具包
yum groupinstall -y development
-
安装扩展包
yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel
-
下载Python2.7.6
wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
-
解压Python2.7.6
tar -xvf Python-2.7.6.tar.xz
-
进入Python2.7.6目录
cd Python-2.7.6
-
编译安装Python2.7.6
./configure
make && make altinstall
二、解决Yum不支持Python2.7的问题
-
将老的Python程序进行备份
mv /usr/bin/python /usr/bin/python2.6.6
-
建立新的Python链接
ln -s /usr/local/bin/python2.7 /usr/bin/python
-
修改/usr/bin/yum文件
vi /usr/bin/yum
将第一行的 #!/usr/bin/python 改为 #!/usr/bin/python2.6.6
三、安装setuptools 和 pip
-
下载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 -
四、安装libxslt-devel支持lxml
yum install libxslt-devel
五、安装Scrapy
pip install scrapy