系统环境:win7,Python 3.6.4
问题描述:使用系统命令cmd安装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 "e:\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-ddfu3m3e\\Twisted\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\ADMINI~1\AppData\Local\Temp\pip-record-xchu0grh\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-ddfu3m3e\Twisted\
原因分析:安装scrapy时候,需要安装Microsoft Visual C++ 14.0,但是系统中没有,所以会报错。
解决方案:
1.查找安装过程中Twisted的版本,我的是python3.6 ,64位(红色边框内)
2.下载对应的whl文件,红框内是和我系统匹配的whl文件
下载网址:https://www.lfd.uci.edu/~gohlke/pythonlibs/
3.在本地进行安装whl文件
pip install Twisted-18.9.0-cp36-cp36m-win_amd64.whl
4.重新安装scrapy
pip install Scrapy
5.测试scrapy是否安装成功
安装成功