【发布时间】:2011-09-26 23:03:20
【问题描述】:
我已经安装了 MSVC++ 2010 Express,并且我的 vcvarsall.bat 文件位于 C:\Program Files\Microsoft Visual Studio 10.0\VC,它位于我的系统 PATH 中。当我运行easy_install 时,它找不到vcvarsall.bat。
我需要在 distutils.cfg 文件中设置什么以将其指向我的 MSVC++ 安装吗?
G:\>easy_install hg-git
install_dir C:\Python26\Lib\site-packages\
Searching for hg-git
Best match: hg-git 0.2.6
Processing hg_git-0.2.6-py2.6.egg
hg-git 0.2.6 is already the active version in easy-install.pth
Using c:\python26\lib\site-packages\hg_git-0.2.6-py2.6.egg
Processing dependencies for hg-git
Searching for dulwich>=0.6.0
Reading http://pypi.python.org/simple/dulwich/
Reading http://samba.org/~jelmer/dulwich
Reading http://launchpad.net/dulwich
Best match: dulwich 0.7.1
Downloading http://www.samba.org/~jelmer/dulwich/dulwich-0.7.1.tar.gz
Processing dulwich-0.7.1.tar.gz
Running dulwich-0.7.1\setup.py -q bdist_egg --dist-dir c:\docume~1\mlin\locals~1
\temp\easy_install-fhraep\dulwich-0.7.1\egg-dist-tmp-qozily
error: Setup script exited with error: Unable to find vcvarsall.bat
【问题讨论】:
-
AFAIK,您需要 MSVC++ 2008 来安装需要 C/C++ 编译器的扩展,因为在 Windows 上构建 Python 已经有一段时间了。由于 MS 运行时库问题,不同版本的编译器不能混合使用。您仍然可以从here 下载 2008 Express Edition。
-
感谢您指出这一点,马蒂诺。我通过使用 MinGW gcc 编译器解决了我的特定问题,因为它比安装 MSVC++ 2008 更快。我仍然想知道在哪里设置对 vsvarsall.bat 的引用...
-
这是一个解决方法,使用 MinGW gcc:gist.github.com/1059280
-
更新: 我为 MSVC++ 2008 提供的链接现在显示“抱歉。此下载不再可用。您选择的下载已停用。”所以看起来使用 MinGW gcc 是要走的路。
-
还要注意切换到mingw32编译器doesn't work for all extensions.
标签: python distutils easy-install visual-studio-2010