'easy_install -U cython' fails complaining about vcvarsall.bat and -mno-cygwin

假装没事ソ 提交于 2019-12-31 22:36:12

问题


Under Windows, it seems that easy_install with a C dependency isn't very easy.

Attempt 1 - vcvarsall.bat errors

I am installing cython under Windows7, with MinGw; I modified Windows7's PATH to include C:\MinGw\bin. At this point, I tried to easy_install -U cython, and got...

C:\Users\mike_pennington\Desktop\TestDrive>easy_install -U cython
Searching for cython
Reading http://pypi.python.org/simple/cython/
Reading http://www.cython.org
Reading http://cython.org
Best match: Cython 0.15.1
Downloading http://cython.org/release/Cython-0.15.1.zip
Processing Cython-0.15.1.zip
Running Cython-0.15.1\setup.py -q bdist_egg --dist-dir c:\users\mike_p~1\appdata
\local\temp\easy_install-qr1tet\Cython-0.15.1\egg-dist-tmp-556kzq
Compiling module Cython.Plex.Scanners ...
Compiling module Cython.Compiler.Scanning ...
Compiling module Cython.Compiler.Parsing ...
Compiling module Cython.Compiler.Visitor ...
Compiling module Cython.Compiler.Code ...
Compiling module Cython.Runtime.refnanny ...
warning: no files found matching 'bugs.txt' under directory 'tests'
error: Setup script exited with error: Unable to find vcvarsall.bat

C:\Users\mike_pennington\Desktop\TestDrive>

Attempt 2 - Fix vcvarsall.bat errors

Next, following the advice of a blog I found, I also tried putting this in C:\Python27\Lib\distutils\distutils.cfg to fix the vcvarsall.bat error.

[build]
compiler=mingw32

This only helps marginally...

C:\Python27\Lib\DISTUT~1>easy_install -U cython
Searching for cython
Reading http://pypi.python.org/simple/cython/
Reading http://www.cython.org
Reading http://cython.org
Best match: Cython 0.15.1
Downloading http://cython.org/release/Cython-0.15.1.zip
Processing Cython-0.15.1.zip
Running Cython-0.15.1\setup.py -q bdist_egg --dist-dir c:\users\mike_p~1\appdata
\local\temp\easy_install-kfif_o\Cython-0.15.1\egg-dist-tmp-o1tbkp
Compiling module Cython.Plex.Scanners ...
Compiling module Cython.Compiler.Scanning ...
Compiling module Cython.Compiler.Parsing ...
Compiling module Cython.Compiler.Visitor ...
Compiling module Cython.Compiler.Code ...
Compiling module Cython.Runtime.refnanny ...
warning: no files found matching 'bugs.txt' under directory 'tests'
cc1.exe: error: unrecognized command line option '-mno-cygwin'
error: Setup script exited with error: command 'gcc' failed with exit status 1

C:\Python27\Lib\DISTUT~1>

Caveat - No cygwin or precompiled binaries

I realize that I might be able to get this working under cygwin; however, I don't want cygwin dependencies on this library; I need native Windows7 output.

If possible, I would like to avoid precompiled Cython binaries because as the author says, they are "unsupported and for testing purposes only".

Question

How can I get cython to install via easy_install under Windows7 with MinGw?


回答1:


After more some googling, I found guidance that recommended removing -mno-cygwin from C:\Python27\Lib\distutils\cygwinccompiler.py because of a distutils bug.

Removing -mno-cygwin from C:\Python27\Lib\distutils\cygwinccompiler.py got cython to compile.



来源:https://stackoverflow.com/questions/8531983/easy-install-u-cython-fails-complaining-about-vcvarsall-bat-and-mno-cygwin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!