scrapy install
一、安装Python2.7.6
更新CentOSlib库文件
yum -y update
安装开发工具包
yum groupinstall -y development
安装扩展包
yum install -y gcc libffi-devel zlib-dev openssl-devel sqlite-devel bzip2-devel
下载Python2.7.11
wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tar.xz
解压Python2.7.11
tar -xvf Python-2.7.11.tar.xz
进入Python2.7.11目录
cd Python-2.7.11
编译安装Python2.7.11
./configure make && make install
二、解决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
六、安装MySQL-python
通过yum安装MySQL-python不知道为什么不成功
自己下载安装就可以成功,命令如下
wget http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz/download tar zxf MySQL-python-1.2.3.tar.gz && cd MySQL-python-1.2.3 python setup.py build python setup.py install
如果在执行pythonsetup.pybuild时,报EnvironmentError:mysql_confignotfound的话,先查找mysql_config的位置,使用find/-namemysql_config,我的是在/usr/local/mysql/bin/mysql_config,然后修改MySQL-python-1.2.3目录下的site.cfg文件,去掉mysql_config=XXX这行的注释,并改成mysql_config=/usr/local/mysql/bin/mysql_config,以自己机器的为准.
再执行下命令就可以了
python setup.py build python setup.py install
七、安装Pillow
先安装依赖包
sudo yum install libtiff-devel libjpeg-devel libzip-devel freetype-devel lcms2-devel libwebp-devel tcl-devel tk-devel
然后执行
pip install Pillow