问题 'easy_install -U cython'无法抱怨vcvarsall.bat和-mno-cygwin


在Windows下,它似乎 easy_install 具有C依赖性并不是很容易。

尝试1 - vcvarsall.bat 错误

我正在安装 cython 在Windows7下,用 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>

尝试2 - 修复 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;但是,我不想要 cygwin 依赖于这个库;我需要原生的Windows7输出。

如果可能的话,我想避免 预编译的Cython二进制文件 因为正如作者所说,它们“不受支持,仅用于测试目的”。

我怎样才能得到 cython 通过安装 easy_install 在Windows7下使用 MinGw


4719
2017-12-16 09:12


起源



答案:


经过更多的谷歌搜索,我找到了建议删除的指导 -mno-cygwin 从 C:\Python27\Lib\distutils\cygwinccompiler.py 因为一个 distutils bug

删除 -mno-cygwin 从 C:\Python27\Lib\distutils\cygwinccompiler.py 得到 cython 编译。


15
2017-12-16 10:05



此修复程序对我不起作用,但会创建一个新错误: collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1 - EML
也没对我工作.. Server 2008 R2 64bit - MFB
@MFB,删除后你得到了什么错误 -mno-cygwin?什么版本的python? - Mike Pennington
@MikePennington,我去重现错误,现在我完全有了一个新的错误。对不起笨蛋。新的错误是 chmod error 我认为可能与UAC有关,但我完全关闭了它。有什么想法吗? - MFB
到目前为止为我工作 - Alexis


答案:


经过更多的谷歌搜索,我找到了建议删除的指导 -mno-cygwin 从 C:\Python27\Lib\distutils\cygwinccompiler.py 因为一个 distutils bug

删除 -mno-cygwin 从 C:\Python27\Lib\distutils\cygwinccompiler.py 得到 cython 编译。


15
2017-12-16 10:05



此修复程序对我不起作用,但会创建一个新错误: collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1 - EML
也没对我工作.. Server 2008 R2 64bit - MFB
@MFB,删除后你得到了什么错误 -mno-cygwin?什么版本的python? - Mike Pennington
@MikePennington,我去重现错误,现在我完全有了一个新的错误。对不起笨蛋。新的错误是 chmod error 我认为可能与UAC有关,但我完全关闭了它。有什么想法吗? - MFB
到目前为止为我工作 - Alexis