欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Ubuntu 14.04安装Scrapy

程序员文章站 2022-03-02 23:24:23
...

参考:https://docs.scrapy.org/en/latest/intro/install.html

以下命令都在root用户下执行

1、更新apt-get软件源仓库:

echo -e "deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse\n"\
"deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse\n"\
"deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse\n"\
"deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse\n"\
"deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse\n"\
"deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse\n"\
"deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse\n"\
"deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse\n"\
"deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse\n"\
"deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse" > /etc/apt/sources.list

2、更新软件包列表:

apt-get update

3、安装Scrapy依赖的软件包:

apt-get install python-dev python-pip libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libssl-dev

4、为pip更新软件源仓库,否则会发生网络问题。

mkdir /root/.pip/
echo -e "[global]\n"\
"index-url = http://pypi.douban.com/simple\n"\
"[install]\n"\
"trusted-host = pypi.douban.com"

 5、升级setuptools至最新版本,否则安装scrapy时会报错:

pip install --upgrade setuptools

6、安装Scrapy依赖的其它python包,不知道为什么Scrapy本身没有管理这些包:

pip install configparser
pip install enum
pip install enum34

7、安装Scrapy

pip install scrapy

 

相关标签: Scrapy