在Windows下,似乎具有C依赖性的easy_install
并不容易。
vcvarsall.bat
错误我在Windows7下安装cython
,MinGw
;我修改了Windows7的PATH
以包含C:\MinGw\bin
。此时,我尝试了easy_install -U cython
,并得到了......
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>
vcvarsall.bat
错误接下来,根据我发现的博客的建议,我也尝试将其放在C:\Python27\Lib\distutils\distutils.cfg
中以解决vcvarsall.bat
错误。
[build]
compiler=mingw32
这只会有点帮助...
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>
我意识到我可能能够在cygwin
下工作;但是,我不希望cygwin
依赖于这个库;我需要原生的Windows7输出。
如果可能的话,我想避免使用precompiled Cython binaries,因为正如作者所说,它们“不受支持,仅用于测试目的”。
如何通过cython
在Windows7下使用easy_install
安装MinGw
?
答案 0 :(得分:15)
在进行了一些谷歌搜索之后,我找到了建议,因为distutils bug而建议从-mno-cygwin
删除C:\Python27\Lib\distutils\cygwinccompiler.py
。
从-mno-cygwin
中移除C:\Python27\Lib\distutils\cygwinccompiler.py
得到cython
以进行编译。