Windows - 使用mingw进行pip安装 - 失败 - cc1.exe:错误:无法识别的命令行选项'-mno-cygwin'

时间:2013-05-01 15:33:14

标签: python-2.7 mingw pip

我正在使用Python27

我的路径包含

C:\MinGW\libexec\gcc\mingw32\4.6.2
C:\MinGW\bin
C:\MinGW\msys\1.0\bin
C:\Python27\
C:\Python27\Scripts

我的PYTHONPATH包含

C:\Python27
C:\Python\Lib\site-packages

当我尝试安装某些软件包时,我不断遇到gcc错误

cc1.exe: error: unrecognized command line option '-mno-cygwin'

似乎是罪魁祸首,但我一直无法找到有关如何解决这个问题的信息。

一些错误示例:

pip install ctypes 
....
building '_ctypes' extension

    C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Isource/libffi_msvc -IC:\Python27\Lib\site-packages\numpy\core\include -IC:\boost_1_53_0 -IC:\Python27\include -IC:\Python27\PC -c source/_ctypes.c -o
    build\temp.win32-2.7\Release\source\_ctypes.o

    cc1.exe: error: unrecognized command line option '-mno-cygwin'

    error: command 'gcc' failed with exit status 1

另一个有同样问题的人

pip install bzr
....
building 'bzrlib._annotator_pyx' extension

C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DWIN32 -IC:\Python27\Lib\site-packages\numpy\core\include -IC:\boost_1_53_0 -IC:\Python27\include -IC:\Python27\PC -c bzrlib/_annotator_pyx.c -o build\
temp.win32-2.7\Release\bzrlib\_annotator_pyx.o

cc1.exe: error: unrecognized command line option '-mno-cygwin'



  Cannot build extension "bzrlib._annotator_pyx".

1 个答案:

答案 0 :(得分:3)

-mno-cygwin中的

Python\Lib\distutils\cygwinccompiler.py会导致此问题:请参阅Compiling with cython and mingw produces gcc: error: unrecognized command line option '-mno-cygwin'http://korbinin.blogspot.com/2013/03/cython-mno-cygwin-problems.html

我的Python发行版(Anaconda)的cygwinccompiler.py虽然没有。无论如何,在删除-mno-cygwin类定义中的所有Mingw32CCompiler后,您应该能够编译。