Cython 无法正常工作,无法诊断问题

Cython not working properly, and unable to diagnose the issue

为了简短起见,我正在做一个项目,我需要 Cython 才能工作。在 windows 上安装 Cython 时,我已经阅读了每一行文档,并且完全按照所说的进行操作。尽管如此,我仍然无法让 Cython 正常工作。当我导入模块时,一切正常。当我尝试从 .pyx 文件编译时出现问题。

C 文件生成得很好,但是有两个问题。首先是无论出于何种原因,我得到:

raise ValueError("Unknown MS Compiler Version 1929")

它并没有就此结束。当我尝试查找 pyd 文件时,生成了 0 个文件。目录中没有 pyd 文件。在 C 文件中,它使用 #include "Python.h",显示错误,并给出以下消息:

#include errors detected. Please update your includePath. IntelliSense features for this translation unit (C:\Users\...\Workspace\cython_test\example_py.c) will be provided by the Tag Parser.

我已经尝试过寻找解决这个问题的方法,但绝对没有任何帮助...我尝试安装 MSVC,并在我的环境变量中正确设置 MinGW。我试过重启我的电脑,卸载并重新安装 Python、MinGW、VSCode,甚至尝试翻阅文档寻找解决方法,但都无济于事。

我终于解决了这个问题。 Cython 文档为 Windows 推荐了错误的编译器和 SDK 框架。当你想要编译 Cython 文件时,你需要通过 Visual Studio Build Tools 下载 SDK。只有这样,您才能为 Cython 编译和构建...