首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将easy_install指向vcvarsall.bat?

如何将easy_install指向vcvarsall.bat?
EN

Stack Overflow用户
提问于 2011-07-02 02:17:04
回答 1查看 76.4K关注 0票数 45

我已经安装了MSVC++ 2010Express,并且我的vcvarsall.bat文件位于C:\Program Files\Microsoft Visual Studio 10.0\VC,它位于我的系统路径中。当我运行easy_install时,它找不到vcvarsall.bat。

是否需要在distutils.cfg文件中设置什么内容才能将其指向MSVC++安装?

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-01-03 05:54:32

我仍然想知道在哪里设置对vsvarsall.bat的引用...

嗯,正如马蒂诺所写的,你必须安装Visual Studio2008或Visual C++ Express。话虽如此,我知道您想知道Python在哪里查找这个批处理文件。您可以通过查看distutils/msvc9编译器.py标准模块中的find_vcvarsall函数的definition来了解这一点。Python依次检查注册表中是否有任何文件夹保存在注册表项下

  • HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\VisualStudio\9.0\Setup\VC\ProductDir
  • HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\VCExpress\9.0\Setup\VC\ProductDir

(64位Windows)或

  • HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\9.0\Setup\VC\ProductDir
  • HKEY_LOCAL_MACHINE\Software\Microsoft\VCExpress\9.0\Setup\VC\ProductDir

(对于32位Windows)存在,如果存在,它会将该文件夹视为包含vcvarsall.bat文件的文件夹。如果这些文件夹都不存在,Python会检查是否有环境变量VS90COMNTOOLS。如果该变量退出,Python会将比该变量的值高两级的文件夹视为包含vcvarsall.bat文件的文件夹。

另请参阅我的other答案,它解释了为什么不能使用MSVC++ 2010构建Python2.6的扩展

编辑: VC++ 2008文件现在打包在MS的安装程序中,可以从here下载。安装完成后,vcvarsall.bat将位于C:\Users\username\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0

票数 57
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6551724

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档