如何将 easy_install 指向 vcvarsall.bat?

发布于 2024-11-18 06:10:54 字数 1111 浏览 13 评论 0原文

我已经安装了 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

I already have MSVC++ 2010 Express installed, and my vcvarsall.bat file is at C:\Program Files\Microsoft Visual Studio 10.0\VC, which is in my system PATH. When I run easy_install, it can't find vcvarsall.bat.

Is there something I need to set in my distutils.cfg file to point it to my MSVC++ installation?

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

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

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

发布评论

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

评论(2

轮廓§ 2024-11-25 06:10:54

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

好吧,正如 martineau 所写,您必须安装 Visual Studio 2008 或 Visual C++ Express。话虽如此,我知道您想知道 Python 在哪里查找这个批处理文件。您可以通过查看 definition< 来看到这一点distutils/msvc9compiler.py 标准模块中 find_vcvarsall 函数的 /code>。 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 的安装程序中,可以下载

I'd still like to know where to set that reference to vsvarsall.bat...

Well, as martineau wrote you have to have either Visual Studio 2008 or Visual C++ Express installed. Having said that I understand you would like to know where Python looks for this batch file. You can see this by looking at definition of find_vcvarsall function in distutils/msvc9compiler.py standard module. Python checks in turn if any of folders saved in the registry under keys

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

(for 64bit Windows) or

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

(for 32bit Windows) exists and if so it treats such folder as the one containing vcvarsall.bat file. If none of these folders exists Python checks if there's environment variable VS90COMNTOOLS. If this variable exits Python treats folder two levels above value of this variable as the folder containing vcvarsall.bat file.

See also my other answer which explains why you can't use MSVC++ 2010 to build extensions for Python 2.6

EDIT:
The VC++ 2008 files are now packaged in an installer from MS which can be downloaded here. Once installed vcvarsall.bat will be in C:\Users\username\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0

我三岁 2024-11-25 06:10:54

在 python 3.9.12 (anaconda) 上遇到同样的问题,我安装 Visual C++ for Python
C:\Users\UserName\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0

找到 msvc9compiler.py

并在C:\ 用户\用户名\anaconda3\Lib\distutils
显示
VS_BASE = r"Software\Microsoft\VisualStudio%0.1f"

如何将 vcvarsall.bat 指向 python ?

(我添加了系统路径但根本不起作用。)
C:\Users\UserName\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0

请您指出如何为该值添加注册表?
我没有找到 HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\9.0\Setup\VC\ProductDir
在我的电脑中。

Met same problem on python 3.9.12 (anaconda),I install Visual C++ for Python at
C:\Users\UserName\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0

and find the msvc9compiler.py at

C:\Users\UserName\anaconda3\Lib\distutils
showed
VS_BASE = r"Software\Microsoft\VisualStudio%0.1f"

how to point the vcvarsall.bat to python ?

(I added the system PATH but not working at all.)
C:\Users\UserName\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0

May you please point out how to add registry for the value?
I did't find HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\9.0\Setup\VC\ProductDir
in my PC.

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