运行 Python 脚本时找不到 vcvarsall.bat [英] Cannot find vcvarsall.bat when running a Python script

查看:55
本文介绍了运行 Python 脚本时找不到 vcvarsall.bat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Vista 上工作,使用 Python 2.6.4.我正在使用一个利用 Python 脚本的软件,但遇到了消息:

I am working on Vista, and using Python 2.6.4. I am using a software that utilizes a Python script, but bumped into the message:

cannot find vcvarsall.bat

所以,我安装了visual c++ 2010.仍然没有找到该文件——尽管它在那里.我的猜测(一个非常没有受过教育的人......)是路径错误的某个地方,因为我还有一个旧的视觉 2008(非常空)文件夹.我不知道在哪里对新路径进行更改.我是否更改了注册表或脚本中的某些内容?或者其他地方?

So, I installed visual c++ 2010. Still the file is not found - though, it is there. My guess (a very uneducated one...) is that somewhere the path is wrong, because I also have an old visual 2008 (pretty empty) folder. I have no idea where to make the changes for the new path. Do I change something in the registry or in the script? Or somewhere else?

推荐答案

看来 Python 正在明确地寻找 Visual Studio 2008.我遇到了这个问题,即使它在路径上也找不到 vcvarsall.bat.

It seems that Python is looking explicitly for Visual Studio 2008. I encountered this problem where it couldn't find vcvarsall.bat even though it was on the path.

事实证明,Visual Studio 2010 创建了以下环境变量:

It turns out that Visual Studio 2010 creates the following environment variable:

SET VS100COMNTOOLS=C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\

修复方法是创建一个名为 VS90COMNTOOLS 的变量,并将该变量指向您的 Visual Studio 2010 通用工具文件夹,例如

The fix is to create a variable called VS90COMNTOOLS and have that point to your Visual Studio 2010 common tools folder, e.g.

SET VS90COMNTOOLS=C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\

这为我修复了它,我现在可以使用 Visual Studio 2010 编译器构建包.

That fixed it for me and I can now build packages using the Visual Studio 2010 compiler.

您还可以使用以下命令将 VS90 环境变量设置为指向 VS100 环境变量:

You can also set the VS90 environment variable to point to the VS100 environment variable using the command below:

SET VS90COMNTOOLS=%VS100COMNTOOLS%

这篇关于运行 Python 脚本时找不到 vcvarsall.bat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆