本文创建于:2018-12-01,最后修改于:2018-12-01
Windows 下安装 Scrapy 报错
- 安装环境:
Windows 10
,Visual Studio IDE Community 2017
,Python 3.7.1
,pip 18.1
- 安装时间: 2018-12-01
- 命令行下
pip install scrapy
报错。 主要报错内容摘录如下:
raiser.c
c:\python\python37\include\pyconfig.h(59): fatal error C1083: 无法打开包括文件:
“io.h”: No such file or directory
error: command 'D:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community
\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\python\python37\python.exe -u -c "import setuptools, tokenize;__file__=
'C:\\Users\\Gene\\AppData\\Local\\Temp\\pip-install-8zvr3tmp\\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\Gene\AppData\Local
\Temp\pip-record-gmwfuu0f\install-record.txt --single-version-externally-managed
--compile" failed with error code 1 in C:\Users\Gene\ AppData\Local\Temp\
pip-install-8zvr3tmp\Twisted\
错误原因
- 参考网上资料,错误原因在于 Visual Studio IDE Community 2017 安装不完全, 缺少
Windows 10 SDK
.
解决方案
-
下载
Visual Studio IDE Community 2017
. -
打开后,修改安装,勾选
“用于桌面 C++[x86 和 x64] 的 Windows 10 SDK (10.0.16299.0)”
(版本可能有所差异,当前时间为 2018-12-01,有两个 Windows 10 SDK 版本可选,选的版本号较高的那个)
- 再次执行
pip install scrapy
, 成功!
参考
[1] Cython- Cannot open include file: ‘io.h’: No such file or directory https://stackoverflow.com/questions/40018405/cython-cannot-open-include-file-io-h-no-such-file-or-directory?answertab=active#tab-top
[2] 解决windows下使用pip install scrapy报错cannot open include file: ‘io.h’:…问题。https://blog.youkuaiyun.com/zaishijizhidian/article/details/81196560
~~~~~~~~~~~~~ 本文结束于此 ~~~~~~~~~~~~~
------------------------为方便阅读本文,此处宣告文章结束------------------------
------------------------为方便阅读本文,此处宣告文章结束------------------------
------------------------为方便阅读本文,此处宣告文章结束------------------------
------------------------为方便阅读本文,此处宣告文章结束------------------------
------------------------为方便阅读本文,此处宣告文章结束------------------------
------------------------为方便阅读本文,此处宣告文章结束------------------------
------------------------为方便阅读本文,此处宣告文章结束------------------------
------------------------为方便阅读本文,此处宣告文章结束------------------------
------------------------为方便阅读本文,此处宣告文章结束------------------------
------------------------为方便阅读本文,此处宣告文章结束------------------------
------------------------为方便阅读本文,此处宣告文章结束------------------------
------------------------为方便阅读本文,此处宣告文章结束------------------------~~~~~~~~~~~~~ 本文结束于此 ~~~~~~~~~~~~~