【问题标题】:'easy_install -U cython' fails complaining about vcvarsall.bat and -mno-cygwin'easy_install -U cython' 无法抱怨 vcvarsall.bat 和 -mno-cygwin
【发布时间】:2012-01-21 20:25:21
【问题描述】:

在 Windows 下,easy_install 带有 C 依赖似乎不是很容易。

尝试 1 - 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>

尝试 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 输出。

如果可能,我想避免使用precompiled Cython binaries,因为正如作者所说,它们“不受支持且仅用于测试目的”。

问题

如何让cython 在Windows7 下通过easy_install 安装MinGw

【问题讨论】:

    标签: python windows mingw cython easy-install


    【解决方案1】:

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

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

    【讨论】:

    • 此修复对我不起作用,但会产生一个新错误:collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1
    • @MFB,删除-mno-cygwin 后出现什么错误?什么版本的python?
    • @MikePennington,我去重现错误,现在我完全有一个新错误。对不起那个流浪汉。新错误是chmod error,我认为这可能与 UAC 有关,但我完全关闭了它。有什么想法吗?
    猜你喜欢
    • 1970-01-01
    • 2011-08-27
    • 2011-09-26
    • 2014-08-14
    • 1970-01-01
    • 2012-11-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多