在windows MinGW32下安装 cython 的遭遇

在windows下从cmd窗口 进入到 cython 包目录 

运行 python setup.py build

结果报错: error: Unable to find vcvarsall.bat

然后换做运行: python setup.py build --compiler=mingw32

或者在 python安装目录下: python\Lib\distutils\新建 distutils.cfg

里面加上:

 

[build]
compiler=mingw32

[build_ext]
compiler = mingw32

 

再调用 python setup.py build

]

又报错: error: comand "gcc" failed with exit status 1

进入python安装目录里的 python\Lib\distutils\cygwinccompiler.py,把里面的-mno-cygwin 相关的参数去掉

再次运行: python setup.py build --compiler=mingw32

好了,这次创建成功了。 


可以直接下载安装 windows 二进制包

http://www.lfd.uci.edu/~gohlke/pythonlibs/#cython 

教程中的这段代码有问题(来自:http://docs.cython.org/src/userguide/language_basics.html):

cdef:
     struct Spam:
         int tons
    
     int i
     float f
    Spam *p
    
     void f(Spam *s):
        print s.tons,  " Tons of spam "

 python setup.py build_ext --inplace 编译 回报:

 Function signature does not match previous declaration 的错误

原因在于 定义的变量名和函数名在同一个域中重名 

转载于:https://www.cnblogs.com/vilyLei/articles/2711368.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值