编译Cython代码时出现致命错误C1083:无法打开包含文件:'io.h'

4

我使用Cython将我的Python程序转换为C代码。现在,我在使用MS Visual Studio编译器编译时遇到了问题。我收到了以下错误:

C:\Python34\include\pyconfig.h(68) : fatal error C1083: 
Cannot open include file: 'io.h': No such file or directory

我正在从控制台运行该命令

cl /c main.c /nologo /Ox /MD /W3 /GS- /DNDEBUG 
-Ic:\Python34\include -Ic:\Python34\PC /link /OUT:"main.exe" 

你是如何为 MSVC 配置 Cython 的呢?你所使用的 MSVC 版本是否和构建 Python(和 Cython)所用版本一致? - abarnert
2
INCLUDE环境变量是否设置为MSVC包含目录?例如 C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE - Eryk Sun
1
@eryksun您是指将第二个路径变量设置为C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE吗?是的,我刚刚尝试了一下,但还是出现了相同的错误。 - the_prole
1个回答

3

我在电脑上导航至 C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include,但文件 io.h 并不存在。看起来问题是该文件实际上不存在!

根据另一个回答,这是一个 POSIX 兼容性库:failing to compile a project, missing io.h file

我不确定为什么会缺少这个文件。另一个回答建议重新安装一些东西:Installation of Visual Studio 2010 (any edition) installs only 2 files in the C++ headers directory

编辑:当我导航至 C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2017\Visual Studio Tools 时,所有东西都可以正常工作。那里有一些 Developer Command Prompt for VS XXX 快捷方式。我打开其中一个,所有的编译命令都成功了。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接