- Step 1 安装依赖包
sudo apt-get install python-dev python-pip libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libssl-dev
sudo apt-get install python3 python3-dev
!Note: 这步必须做,不然后面报错什么 twisted 没装成啥的,都是这第一步的包没装好!!!
- Step 2 virtualenv 安装 Scrapy
To install globally with pip
$ sudo pip3 install virtualenv
virtual a environment
$ virtualenv ENV # Where ENV is a directory to place the new virtual environment.
activate script
$ source bin/activate # or: $ . bin/activate
Inside a virtualenv, you can install Scrapy with pip after that:
pip install scrapy
---------------------------- 在此分割线上已成功安装完 Scrapy 了 ------------------------------
- virtualenv 的一些其他操作
退出虚拟环境,
$ deactivate
删除虚拟环境
$ rm -r /path/to/ENV
参考
-
Scrapy 官网: Installation guide
-
Virtualenv 官网 的 installation 和 User guide
网友评论