前提准备:
1.需要安装Python【我安装的Python版本是3.6.4】
2.需要升级pip版本
pip install --upgrade pip
3.通过pip 安装 Scrapy 框架
Scrapy的安装的命令:
pip install Scrapy
问题描述:
在Windows10上安装Scrapy的时候安装失败
Command "d:\tools\python36-32\python.exe -u -c "import setuptools,
tokenize;__file__='C:\\Users\\Xu\\AppData\\Local\\Temp\\pip-build-5ha9fx97\\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\Xu\AppData\Local\Temp\pip-6ndirz76-record\install-record.txt --single-version-externally-managed
--compile" failed with error code 1 in C:\Users\Xu\AppData\Local\Temp\pip-build-5ha9fx97\Twisted\
解决方案:
1.确保安装pywin32
可以参考我的pywin32安装文章
也可以直接进入github下载最新版本自行安装
下载对应你的版本进行安装
2.确保安装pyOpenSSL,lxml,Twisted
pip install pyOpenSSL
验证: import OpenSSL
pip install lxml
验证:import pip; print(pip.pep425tags.get_supported())
pip install Twisted
这里要注意,如果安装不成功的话,可以进入
https://www.lfd.uci.edu/~gohlke/pythonlibs/
网页中搜索twisted
找到对应的版本,用 pip install +文件名在cmd命令下进行安装。
如:pip install Twisted-17.9.0-cp36-cp36m-win32.whl
3.pip install wheel
pip install Twisted-17.9.0-cp36-cp36m-win32.whl
pip install Scrapy-1.5.0-py2.py3-none-any.whl
输入scrapy -h验证
可参考资料