使用cython和mingw进行编译会产生gcc:错误:无法识别的命令行选项'-mno-cygwin' [英] Compiling with cython and mingw produces gcc: error: unrecognized command line option '-mno-cygwin'

查看:526
本文介绍了使用cython和mingw进行编译会产生gcc:错误:无法识别的命令行选项'-mno-cygwin'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用mingw(64位)在win 7 64位中使用cython编译python扩展.
我正在使用Python 2.6(Active Python 2.6.6)和足够的distutils.cfg文件(将mingw设置为编译器)

I'm trying to compile a python extension with cython in win 7 64-bit using mingw (64-bit).
I'm working with Python 2.6 (Active Python 2.6.6) and with the adequate distutils.cfg file (setting mingw as the compiler)

执行时

> C:\Python26\programas\Cython>python setup.py build_ext --inplace

我收到一条错误消息,说gcc没有-mno-cygwin选项:

I get an error saying that gcc has not an -mno-cygwin option:

> C:\Python26\programas\Cython>python setup.py build_ext --inplace
running build_ext
skipping 'hello2.c' Cython extension (up-to-date)
building 'hello2' extension
C:\mingw\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python26\include -IC:\Python26\PC -c hello2.c -o build\temp.win-amd64-2.6\Release\hello2.o
gcc: error: unrecognized command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1

gcc是:

C:\>gcc --version
gcc (GCC) 4.7.0 20110430 (experimental)
Copyright (C) 2011 Free Software Foundation, Inc.

我该如何解决?

推荐答案

听起来GCC 4.7.0终于删除了不推荐使用的-mno-cygwin选项,但是distutils尚未赶上它.或者安装稍旧版本的MinGW,或者在Python目录中编辑distutils\cygwinccompiler.py来删除所有-mno-cygwin实例.

It sounds like GCC 4.7.0 has finally removed the deprecated -mno-cygwin option, but distutils has not yet caught up with it. Either install a slightly older version of MinGW, or edit distutils\cygwinccompiler.py in your Python directory to remove all instances of -mno-cygwin.

这篇关于使用cython和mingw进行编译会产生gcc:错误:无法识别的命令行选项'-mno-cygwin'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆