Python 3.4:编译适用于64位Windows的cython模块 [英] Python 3.4: compile cython module for 64-bit windows
问题描述
我有一个.pyx模块,我一直在尝试通过各种方式将其编译为与Windows上的64位python 3.4一起使用,但没有成功.
I have a .pyx module that I've been trying to compile for use with 64-bit python 3.4 on Windows through various means but with no success.
经过反复试验,确实可以编译
After a lot of trial and error, it does compile with
python setup.py build_ext --inplace --compiler=mingw32
但是,当然,这不适用于64位python.
but of course, that won't work with 64-bit python.
使用msvc作为编译器,错误是
With msvc as the compiler, the error is
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)(包括vcvarsall.bat)中似乎有一些Microsoft Visual Studio 10.0.
也欢迎不使用distutils解决方案.
Solutions that don't revolve around distutils are also welcome.
---其他信息
我现在已经修改了distutils以根据 http://bugs.python.org/issue11723 <识别mingw-w64 .然后,我使用gendef和dlltool制作了libpython34.a,但出现错误
I have now modified distutils to recognize mingw-w64 as per http://bugs.python.org/issue11723. I then made libpython34.a using gendef and dlltool, but get an error
c:\Python34\libs/libpython34.a: file not recongnized: File truncated
跑步时
python setup.py build_ext --inplace --compiler=mingw64
推荐答案
好吧,终于我设法使它起作用了.
Ok, at long last I managed to make it work.
Christoph Gohlke( http://www.lfd.uci.edu/〜gohlke/pythonlibs )是关键.
The fantastic resources by Christoph Gohlke (http://www.lfd.uci.edu/~gohlke/pythonlibs) are key.
- 以常规方式安装所需的Python版本
- 从Gohlke网站安装所需的任何扩展程序
- 从 http://tdm-gcc.tdragon.net/download 安装MinGW-w64
- 按照 http://bugs.python.org/issue11723 修补distutils
- 从Gohlke网站安装适当版本的libpython
- 鲍勃的叔叔
- Install your desired Python version in the conventional way
- Install any extensions you need from Gohlke's site
- Install MinGW-w64 from http://tdm-gcc.tdragon.net/download
- Patch distutils as per http://bugs.python.org/issue11723
- Install the appropriate version of libpython from Gohlke's site
- Bob's yer uncle
(为此任务尝试了各种荒唐的建议,我已经走了许多步骤,但据我所知,这些是最终真正有所作为的唯一步骤)
(Trying all sorts of wild suggestions for this task, I have gone through many more steps but as far as I can tell, these are the only ones that actually made a difference in the end)
这篇关于Python 3.4:编译适用于64位Windows的cython模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!