【发布时间】:2015-02-13 19:00:39
【问题描述】:
我有一个 .pyx 模块,我一直在尝试通过各种方式编译它以在 Windows 上与 64 位 python 3.4 一起使用,但没有成功。
经过大量的试验和错误,它确实可以编译
python setup.py build_ext --inplace --compiler=mingw32
当然,这不适用于 64 位 python。
以msvc为编译器,报错
File "C:\Python34\lib\distutils\msvc9compiler.py", line 287, in query_vcvarsall
raise ValueError(str(list(result.keys())))
ValueError: ['path']
- Windows 7
- 已安装适用于 Windows 7 和 .NET Framework 4 的 Microsoft Windows SDK
- C:\Program Files (x86) 中似乎有一些 Microsoft Visual Studio 10.0 内容(包括 vcvarsall.bat)
也欢迎不围绕 distutils 的解决方案。
--- 编辑:附加信息
我现在修改了 distutils 以根据 http://bugs.python.org/issue11723 识别 mingw-w64。然后我使用 gendef 和 dlltool 制作了 libpython34.a,但出现错误
c:\Python34\libs/libpython34.a: file not recongnized: File truncated
运行时
python setup.py build_ext --inplace --compiler=mingw64
【问题讨论】:
-
为什么不安装 64 位 mingw 工具链?
-
有什么特别推荐的吗?据我所见,有一些......我安装了 mingw-w64,但 distutils 没有提供它作为选项,所以我想还有更多?
标签: windows python-3.x cython distutils mingw-w64