“easy_install -U cython”未能抱怨 vcvarsall.bat 和 -mno-cygwin

发布于 2024-12-21 07:37:28 字数 2782 浏览 1 评论 0原文

在 Windows 下,带有 C 依赖项的 easy_install 似乎不太容易。

尝试 1 - vcvarsall.bat 错误

我正在 Windows7 下使用 MinGw 安装 cython;我修改了 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 二进制文件 因为作为作者说,它们“不受支持,仅用于测试目的”。

问题

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

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

御弟哥哥 2024-12-28 07:37:28

经过更多谷歌搜索后,我发现建议从 C:\Python27\Lib\distutils\cygwinccompiler.py 中删除 -mno-cygwin ,因为 distutils 错误

C:\Python27\Lib\distutils\cygwinccompiler.py 中删除 -mno-cygwin 即可编译 cython

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文