如何将easy_install指向vcvarsall.bat?

发布于 2021-01-29 15:08:36

我已经安装了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
关注者
0
被浏览
56
1 个回答
  • 面试哥
    面试哥 2021-01-29
    为面试而生,有面试问题,就找面试哥。

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

    好吧,正如martineau所写的那样,您必须安装Visual Studio 2008或Visual C ++
    Express。话虽如此,我了解您想知道Python在哪里查找此批处理文件。您可以通过观察看到definitionfind_vcvarsall在distutils的功能/
    msvc9compiler.py标准模块。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文件的文件夹。

    另请参阅我的其他答案,它解释了为什么您不能使用MSVC ++
    2010来构建Python 2.6的扩展

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



知识点
面圈网VIP题库

面圈网VIP题库全新上线,海量真题题库资源。 90大类考试,超10万份考试真题开放下载啦

去下载看看