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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8531983/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:40:36  来源:igfitidea点击:

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

pythonwindowsmingwcythoneasy-install

提问by Mike Pennington

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

在 Windows 下,easy_installC 依赖似乎不是很容易。

Attempt 1 - vcvarsall.baterrors

尝试 1 -vcvarsall.bat错误

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

cython在 Windows7 下安装,使用MinGw; 我修改了 Windows7PATH以包含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>

Attempt 2 - Fix vcvarsall.baterrors

尝试 2 - 修复vcvarsall.bat错误

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

接下来,按照我找到的博客的建议,我也尝试将其放入C:\Python27\Lib\distutils\distutils.cfg以修复vcvarsall.bat错误。

[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

警告 - 没有 cygwin 或预编译的二进制文件

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

我意识到我也许可以让它在下面工作cygwin;但是,我不想 cygwin依赖这个库;我需要本机 Windows7 输出。

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

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

Question

How can I get cythonto install via easy_installunder Windows7 with MinGw?

如何在 Windows7 下cython通过 安装?easy_installMinGw

回答by Mike Pennington

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

多一些google搜索后,我发现,建议取消指导,-mno-cygwinC:\Python27\Lib\distutils\cygwinccompiler.py因的distutils的错误

Removing -mno-cygwinfrom C:\Python27\Lib\distutils\cygwinccompiler.pygot cythonto compile.

-mno-cygwinC:\Python27\Lib\distutils\cygwinccompiler.py必须cython编译中删除。