Cython将无法在Windows 7 x64上编译

Nik*_*s R 7 python 64-bit mingw cython windows-7

我正在努力在Windows 7 x64上安装Cython.我下载并安装了automated MinGW installer.使用以下内容为distutils文件夹创建了distutils.cfg:

[build]
compiler = mingw32
Run Code Online (Sandbox Code Playgroud)

添加C:\MinGW\bin到环境变量后,我调用了easy_install Cython但是我收到以下错误.翻阅互联网真的没有给我有用的结果,因为所有这些编译的东西(或者我应该说sh*t?)对我来说是如此新鲜.

c:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x5d59): undefined reference to `_imp__PyObject_GetAttr'
c:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x5dc5): undefined reference to `_imp__PyObject_GetAttr'
c:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x5e31): undefined reference to `_imp__PyObject_GetAttr'
c:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x5ebc): undefined reference to `_imp__PyObject_Call'
c:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x5f08): undefined reference to `_imp__PyDict_New'
c:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x5f49): undefined reference to `_imp__PyObject_SetAttr'
c:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x5ffe): undefined reference to `_imp__PyErr_Occurred'
c:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x6013): undefined reference to `_imp__PyExc_ImportError'
c:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x601e): undefined reference to `_imp__PyErr_SetString'
c:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x602d): undefined reference to `_imp__PyInt_FromLong'
collect2: ld returned 1 exit status
dllwrap: gcc exited with status 1
error: Setup script exited with error: command 'dllwrap' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)

任何想法都错了吗?谢谢 !

更新:我使用dlltools创建libpython27.a然后再次尝试构建Cython,它只是工作正常!但现在,调用cython.exe会传递此错误:

ImportError: DLL load failed, %1 is not a valid Win32-executable.
Run Code Online (Sandbox Code Playgroud)

我假设这是因为我使用Pythonx64但MinGW32编译器?那么,我怎样才能为x64编译它?

leo*_*luk 10

这个网站上有预编译的Cython包.我建议您切换到x86 Python,使用x64版本没有真正的优势.如果你想坚持使用x64,你不能使用MingW,你必须使用MS SDK C++编译器(更多内容).

不要使用MinGW-w64.正如您将注意到的,AMD的AMD64版本中省略了Python的MinGW导入库(例如libpython27.a).这是故意的.不要尝试使用dlltool制作一个.[...] mingw运行时与MSVC运行时冲突也存在问题; 这可能发生在您不期望的地方,例如g ++或gfortran的运行时库内部.