ubuntu 环境下安装 scrapy

来源:互联网 发布:矩阵理论及应用答案 编辑:程序博客网 时间:2024/06/01 10:39

本人使用的是

Linux xxx 3.19.0-31-generic #36~14.04.1-Ubuntu SMP Thu Oct 8 10:21:08 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux


由于 ubuntu 已经安装了两个版本的 python,并且 pip 工具也安装了。


scrapy 当前支持的 python2.7,  通过补全 pip指令, 发现了pip2.

>> pip2 -V

可以版本是 1.5.2,我们进行更新版本

# 安装必须的软件。 (即使不更新 pip 也必须的,不然 安装 scrapy 时可能出现 error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 之类的错误。)

sudo apt-get install  python-dev build-essential

#然后更新

 sudo pip2 install --upgrade pip


更新后,出现一个 pip2.7, 版本为1.7.2


安装 scrapy

sudo apt-get install ibxml2-dev libxslt-dev -y

sudo pip2.7 install scrapy

没有报错,即安装成功


附:

由于 pip 默认使用的源是 https://pypi.python.org/simple, 网络状况不佳,

网上搜索国内的pypi源有

http://pypi.douban.com/  豆瓣

http://pypi.hustunique.com/  华中理工大学

http://pypi.sdutlinux.org/  山东理工大学

http://pypi.mirrors.ustc.edu.cn/  中国科学技术大学

配置默认源。

vim ~/.pip/pip.conf

[global]

index-url=http://pypi.douban.com/simple


使用方法

pip2.7 install package-name  --trusted-host pypi.douban.com



0 0
原创粉丝点击