我一直在尝试在我的 Window 7 系统上安装 Cython for Python 2.7。特别是,我更喜欢 64 位的所有内容。(如果您想知道,我需要 Cython,因为 Cython 是我需要的另一个软件包的组件之一,用于一些专门的数值分析。x64 可能是存储大型数据集的优势。)
于是我从官网下载了x64 Python 2.7。从Christoph Gohlke 那里得到 Cython。当然是 Python 2.7 的 amd64 版本。在安装之前,我将 Python 2.7 添加到注册表中,其中包含在Joe DF 的答案.reg
中找到的文件。之后,我从这里(我认为它不起作用)和这里(但这个应该)安装了 Visual C++ 编译器。此时,我的目录中有所有, , , . 我跑了,没有错误信息。C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin
vcvars32.bat
vcvars64.bat
vcvars86_amd64.bat
vcvarsx86_ia64.bat
vcvars64.bat
随后,我按照这个页面创建了一个“hello world”测试文件。
然后,我得到了这个错误。
...\Tests>python setup.py build_ext --inplace
running build_ext
building 'hello' extension
error: Unable to find vcvarsall.bat
所以我心想:好吧,Cython 找不到那个文件,因为它不存在。(我搜索了整个硬盘驱动器。)所以我vcvars64.bat
从...\VC\bin
to复制\VC
并将名称更改为vcvarsall.bat
. 现在 vcvarsall 错误消失了。而且......自然会出现一个新的错误。
...\Tests>python setup.py build_ext --inplace
running build_ext
building 'hello' extension
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c /nolog
o /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include -IC:\Python27\PC /Tchello.c /F
obuild\temp.win-amd64-2.7\Release\hello.obj
hello.c
C:\Python27\include\pyconfig.h(227) : fatal error C1083: Cannot open include fil
e: 'basetsd.h': No such file or directory
error: command '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64
\cl.exe"' failed with exit status 2
现在我不知道如何进行。我应该怎么办?非常感谢您的帮助。
(为了清楚起见,我确实尝试将编译器设置为 Mingw32。但还有其他错误。我现在专注于让 VC 工作。)
编辑:我尝试按照此页面上的说明使用 SDK 构建环境 CMD 。我收到了同样的错误。