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



我正在使用Python27

我的PATH包含

C:MinGWlibexecgccmingw324.6.2
C:MinGWbin
C:MinGWmsys1.0bin
C:Python27
C:Python27Scripts

我的PYTHONPATH包含

C:Python27
C:PythonLibsite-packages

当我尝试安装某些包时,gcc

总是出错
cc1.exe: error: unrecognized command line option '-mno-cygwin'

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

错误示例:

pip install ctypes 
....
building '_ctypes' extension
    C:MinGWbingcc.exe -mno-cygwin -mdll -O -Wall -Isource/libffi_msvc -IC:Python27Libsite-packagesnumpycoreinclude -IC:boost_1_53_0 -IC:Python27include -IC:Python27PC -c source/_ctypes.c -o
    buildtemp.win32-2.7Releasesource_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:MinGWbingcc.exe -mno-cygwin -mdll -O -Wall -DWIN32 -IC:Python27Libsite-packagesnumpycoreinclude -IC:boost_1_53_0 -IC:Python27include -IC:Python27PC -c bzrlib/_annotator_pyx.c -o build
temp.win32-2.7Releasebzrlib_annotator_pyx.o
cc1.exe: error: unrecognized command line option '-mno-cygwin'

  Cannot build extension "bzrlib._annotator_pyx".

-mno-cygwinPythonLibdistutilscygwinccompiler.py中导致这个问题:参见使用cython和mingw编译产生gcc: error: unrecognized命令行选项'-mno-cygwin'或http://korbinin.blogspot.com/2013/03/cython-mno-cygwin-problems.html。

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

最新更新