本文介绍了用Cython不会在Windows 7 64位编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我挣扎在Windows 7 64位系统安装用Cython。我下载并安装了自动安装的MinGW 。创建的一个distutils.cfg给Distutils的有以下内容的文件夹:

  [建设]
编译器=的mingw32
 

添加后 C:\ MinGW的\ BIN 环境变量,我称之为的easy_install用Cython ,但我得到的以下错误。强奸互联网也真的不给我帮助的resulsts所有该编译东西(或者我应该说奔忙?)的是全新的我。

<$p$p><$c$c>c:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x5d59):未定义的参考`_imp__PyObject_GetAttrc:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x5dc5):未定义的参考`_imp__PyObject_GetAttrc:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x5e31):未定义的参考`_imp__PyObject_GetAttrc:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x5ebc):未定义的参考`_imp__PyObject_Callc:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x5f08):未定义的参考`_imp__PyDict_Newc:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x5f49):未定义的参考`_imp__PyObject_SetAttrc:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x5ffe):未定义的参考`_imp__PyErr_Occurredc:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x6013):未定义的参考`_imp__PyExc_ImportErrorc:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x601e):未定义的参考`_imp__PyErr_SetStringc:\users\niklas\appdata\local\temp\easy_install-dgjjub\cython-0.15\cython\plex\scanners.o:Scanners.c:(.text+0x602d):未定义的参考`_imp__PyInt_FromLongcollect2:劳工处返回1退出状态dllwrap:GCC退出,状态1错误:安装程序脚本退出错误:命令'dllwrap失败,退出状态1

任何想法什么是错?谢谢!

更新:我用dlltools创建libpython27.a,然后再次尝试建立用Cython,它只是正常工作!但现在,调用cython.exe提供了这个错误:

 导入错误:DLL加载失败,%1不是有效的Win32可执行。
 

我想这是因为我使用Pythonx64但MINGW32编译器?所以,我怎么能编译用于基于x64的?

解决方案

有pre-编译用Cython包的。我建议你​​改用x86的Python中,你没有获得真正的优势,通过使用64位版本。如果你想坚持的X64,你不能使用MinGW和您必须使用MS SDK C ++编译器(更多关于这个

I'm struggling with installing Cython on Windows 7 x64.I downloaded and installed the automated MinGW installer. The created a distutils.cfg to the distutils folder with the following content:

[build]
compiler = mingw32

After adding C:\MinGW\bin to the environment variables, I called easy_install Cython but I get the following errors. Raping the internet did really not give me helpful resulsts as all this compiling stuff (or should I say sh*t ?) is so new to me.

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

Any ideas whats wrong ? Thanks !

UPDATE:I used dlltools to create libpython27.a and then again tried to build Cython and it just worked fine !But now, calling cython.exe delivers this error:

ImportError: DLL load failed, %1 is not a valid Win32-executable.

I assume this is because I use Pythonx64 but the MinGW32 compiler ?So, how can i compile it for x64 ?

解决方案

There are pre-compiled Cython packages on this site. I'd suggest you to switch to x86 Python, you gain no real advantage by using the x64 version. If you want to stick with x64, you can't use MingW and you have to use MS SDK C++ compiler (more on this).

这篇关于用Cython不会在Windows 7 64位编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 00:37