我正在使用Cython完成我的第一步,并且已根据wiki中的说明将其安装在我的机器上.
通过Cython教程我得到了pyximport,它应该让cython编译变得非常简单.但是,当我尝试使用它时,我收到以下错误消息(重新格式化):
ImportError: Building module failed:
DistutilsPlatformError('
Python was built with Visual Studio 2003;
extensions must be built with a compiler than can generate compatible binaries.
Visual Studio 2003 was not found on this system. If you have Cygwin installed,
you can try compiling with MingW32, by passing "-c mingw32" to setup.py.',)
Run Code Online (Sandbox Code Playgroud)
所以我的问题是:有谁知道让pyximport使用mingw的方法?
请注意,mingw似乎安装得很好,制作Cython模块(使用setup.py)的好方法对我来说很有用,而且我甚至创建了distutils.cfg像wiki这样的文件告诉我.
小智 12
我最近在四处乱逛,发现了pyximport.install的setup_args参数.这对我有用:
mingw_setup_args={'options': {'build_ext': {'compiler': 'mingw32'}}}
import pyximport; pyximport.install(setup_args=mingw_setup_args)
Run Code Online (Sandbox Code Playgroud)
sun*_*ang 10
C:\ Python2x\LIB \的distutils\distutils.cfg:
[build]
compiler = mingw32
[build_ext]
compiler = mingw32
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3143 次 |
| 最近记录: |