Centos6.7升级python2.6到python2.7
python --version
wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz tar -zxvf Python-2.7.10.tgz cd Python-2.7.10 ./configure --enable-loadable-sqlite-extensions && make && make install
yum list sqlite-devel
mv /usr/bin/python /usr/bin/python2.6.6_bak ln -s /usr/local/bin/python2.7 /usr/bin/python
yum与python2.7版本不兼容,需要指向原来的python2.6
vim /usr/bin/yum
#!/usr/bin/python2.6.6_bak
#!/usr/bin/python2.6.6_bak
- 再次检查版本
[root@cobub04 ~]# python --version
Python 2.7.10
Python 2.7.10
安装pip
下载地址:https://pypi.python.org/pypi/pip
解压,安装
python setup.py install
pip install pyspider 也可以下载pyspder源码后再安装: python setup.py install
这一步需要耐心等待。
注:如果使用pip的时候,报如下错误:
扫描二维码关注公众号,回复:
764125 查看本文章
ImportError: cannot import name HTTPSHandler
可能是openssl,openssl-devel没有安装成功,解决参见链接:
http://jingyan.baidu.com/article/e52e3615aba39640c60c51c3.html;
安装过程中可能会缺少一些包,最好一次都安装上:
yum install libcurl-devel libffi-devel libxml2-devel libxslt-devel
pyspider
通过浏览器查看:http://localhost:5000/
参考:
http://docs.pyspider.org/en/latest/;
https://github.com/binux/pyspider;