python scrapy框架中环境搭建中遇到的坑
1、python 安装 Scrapy 报错
步骤:
通过安装命令安装:
pip install Scrapy
报错内容:
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com
/visual-cpp-build-tools
----------------------------------------
Command "c:\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\yuqin\\AppData\\Local\\Temp\\pip-install-9v7
ghi4u\\Twisted\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(cod
e, __file__, 'exec'))" install --record C:\Users\yuqin\AppData\Local\Temp\pip-record-cosc6m2k\install-record.txt --single-version-ex
ternally-managed --compile" failed with error code 1 in C:\Users\yuqin\AppData\Local\Temp\pip-install-9v7ghi4u\Twisted\
解决:
1、下载twisted对应版本的whl文件
下载地址:http://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted
如:下载Twisted‑18.9.0‑cp37‑cp37m‑win_amd64.whl
2、放到项目根目录下,安装
pip install Twisted-18.9.0-cp37-cp37m-win_amd64.whl
3、安装完成后,再次运行
pip install scrapy
4、安装成功如图
2、提示没有DgSpider
解决:
需要安装DgSpider,命令如下:
Scrapy startproject DgSpider
scrapy相关命令
1、查看scrapy版本命令
scrapy version