1.确认python和pip安装成功
2.安装win32py 提供win32api,下载地址:https://sourceforge.net/projects/pywin32/files/
3.安装lxml lxml是一种使用 Python 编写的库,可以迅速、灵活地处理 XML。下载地址 https://pypi.python.org/pypi/lxml/3.3.1,可用pip下载,
下载命令:python -m pip install lxml
4.出现错误:Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools,需安装Twisted
Twisted安装地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted
- Twisted‑17.9.0‑cp27‑cp27m‑win32.whl
- Twisted‑17.9.0‑cp27‑cp27m‑win_amd64.whl
- Twisted‑17.9.0‑cp34‑cp34m‑win32.whl
- Twisted‑17.9.0‑cp34‑cp34m‑win_amd64.whl
- Twisted‑17.9.0‑cp35‑cp35m‑win32.whl
- Twisted‑17.9.0‑cp35‑cp35m‑win_amd64.whl
- Twisted‑17.9.0‑cp36‑cp36m‑win32.whl
- Twisted‑17.9.0‑cp36‑cp36m‑win_amd64.whl
- Twisted‑17.9.0‑cp37‑cp37m‑win32.whl
- Twisted‑17.9.0‑cp37‑cp37m‑win_amd64.whl
- 在安装Twisted之前,先确定你的pythonb版本,比如我的版本为python3.6.4,那我就该选cp36的,如果你的电脑是64位系统,win_amd64安装失败,可再安装win32的试一下,
- 因为我的64位系统就是安装的win32
pip install C:UsersCRDownloadsTwisted-17.5.0-cp36-cp36m-win_amd64.whl
- 5.安装Scrapy
- pip install Scrapy
- 6.Scrapy运行
在D盘下新建一个pycodes文件夹,打开cmd
D:pycodes>scrapy startproject python123demo
New Scrapy project 'python123demo', using template directory 'c:\users\jing\appdata\local\programs\python\python36-32\lib\site-packages\scrapy\templates\project', created in:
D:pycodespython123demo
You can start your first spider with:
cd python123demo
scrapy genspider example example.com- Scrapy安装成功