无法在 Windows 8 中使用 Python 3.3 找到 vcvarsall.bat

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17658092/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 08:48:54  来源:igfitidea点击:

Unable to find vcvarsall.bat using Python 3.3 in Windows 8

pythonvisual-studiopython-3.xmingwpip

提问by Matt

I am having an issue when I try to run:

我尝试运行时遇到问题:

pip install numpy

I get:

我得到:

unable to find vcvarsall.bat.

I followed this procedure: How to use MinGW's gcc compiler when installing Python package using Pip?.

我遵循了这个过程:How to use MinGW's gcc compiler when installed Python package using Pip? .

  • I installed MinGW with C++ compiler option checked
  • I added MinGW to my path
  • 我安装了 MinGW 并选中了 C++ 编译器选项
  • 我将 MinGW 添加到我的路径中

Here is my path

这是我的路径

 C:\Python33\;%SYSTEMROOT%\SYSTEM32;%SYSTEMROOT%;%SYSTEMROOT%\SYSTEM32\WBEM;%SYSTEMROOT%\SYSTEM32\WINDOWSPOWERSHELL\V1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Python33\;C:\Python33\Scripts;C:\MinGW\bin;
  • I created distutils.cfg with the following lines

    [build]
    compiler=mingw32
    
  • 我用以下几行创建了 distutils.cfg

    [build]
    compiler=mingw32
    

In here:

在这里:

C:\Python33\Lib\distutils\distutils.cfg

Still getting the same error, not sure what I am doing wrong.

仍然得到同样的错误,不知道我做错了什么。

I am using Windows 8 system (32 bit), Python 3.3. I installed Visual Studio 12.0 which I would want to ultimately use as my IDE for Python.

我使用的是 Windows 8 系统(32 位),Python 3.3。我安装了 Visual Studio 12.0,我希望最终将其用作 Python 的 IDE。

Thanks for your help!

谢谢你的帮助!

EDIT:

编辑:

easy_install numpy

Works without a glitch.

工作没有故障。

采纳答案by sk8asd123

I am using the same setup and installing visual studio 2010 express was the easiest solution for me. http://www.microsoft.com/visualstudio/eng/downloads#d-2010-express

我使用相同的设置,安装visual studio 2010 express 对我来说是最简单的解决方案。 http://www.microsoft.com/visualstudio/eng/downloads#d-2010-express

Python 3.3 was built using VS 2010. http://blog.python.org/2012/05/recent-windows-changes-in-python-33.html

Python 3.3 是使用 VS 2010 构建的。 http://blog.python.org/2012/05/recent-windows-changes-in-python-33.html

回答by ?ukasz Wiatrak

I had the same problem on Windows 8, downloading and installing compiled numpylibrary from http://www.lfd.uci.edu/~gohlke/pythonlibs/helped.

我在 Windows 8 上遇到了同样的问题,numpyhttp://www.lfd.uci.edu/~gohlke/pythonlibs/下载和安装编译库有帮助。

回答by Georgi

You can stick with Visual Studio, but you have to "redirect" it to the one you have installed. In my case I have VS 2012, Python 3.3

您可以坚持使用 Visual Studio,但您必须将其“重定向”到您已安装的那个。就我而言,我有 VS 2012,Python 3.3

SET VS100COMNTOOLS=%VS110COMNTOOLS%

SET VS100COMNTOOLS=%VS110COMNTOOLS%

This will make pip use the VS2012's vcvarsall.bat file. Older versions of python might require to alter VS90COMNTOOLS variable.

这将使 pip 使用 VS2012 的 vcvarsall.bat 文件。旧版本的 python 可能需要更改 VS 90COMNTOOLS 变量。

回答by venkatesh

I had the same problem. I have VS2012 and python 2.7

我有同样的问题。我有 VS2012 和 python 2.7

Ran the following in cmd tool

在 cmd 工具中运行以下命令

SET VS90COMNTOOLS=%VS110COMNTOOLS%

设置 VS90COMNTOOLS=%VS110COMNTOOLS%

then used pip install

然后使用 pip install

It worked.

有效。

回答by bremen_matt

As other people have already mentioned, it appears that you do not have Microsoft Visual Studio 2010 installed on your computer. Older versions of Python used Visual Studio 2008, but now the 2010 version is used. The 2010 version in particular is used to compile some of the code (not 2008, 2013, or any other version).

正如其他人已经提到的,您的计算机上似乎没有安装 Microsoft Visual Studio 2010。旧版本的 Python 使用 Visual Studio 2008,但现在使用 2010 版本。2010 版本特别用于编译某些代码(不是 2008、2013 或任何其他版本)。

What is happening is that the installer is looking in your environmental variables for the Visual Studio 2010 tools. Note that Visual Studio 2008 or 2013 will NOT work, since the compiler is specifically looking for the 2010 version of the tools.

发生的情况是安装程序正在查看 Visual Studio 2010 工具的环境变量。请注意,Visual Studio 2008 或 2013 将不起作用,因为编译器专门寻找 2010 版本的工具。

To see if you indeed have the 2010 version properly set up, right click on My Computer. Then go to "Properties". In the window that is opened, there should be an option for "Advanced system settings" on the left hand side. In the new window that opens, go to the "Advanced" tab, then click on the "Environmental Variables" Button. In the "System Variables", there should be a Variable called "VS100COMNTOOLS" that points to the Visual Studio 2010 Tools Directory. On my system, this is "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\".

要查看您是否确实正确设置了 2010 版本,请右键单击我的电脑。然后转到“属性”。在打开的窗口中,左侧应该有一个“高级系统设置”选项。在打开的新窗口中,转到“高级”选项卡,然后单击“环境变量”按钮。在“系统变量”中,应该有一个名为“VS100COMNTOOLS”的变量,它指向 Visual Studio 2010 工具目录。在我的系统上,这是“C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\”。

What one of the users suggested above, was a work around if you have a different version of Visual Studio. For instance, I have a 2013 version of Visual Studio, and hence I have a Variable called "VS120COMNTOOLS" which points to the 2013 toolset. Since the versions of Visual Studio share a lot of the same tools, you could probably compile Python with a newer or older version of Visual Studio, by simply adding a new variable called "VS100COMNTOOLS" which has the value of either %VS120COMNTOOLS%, or the directory that VS120COMNTOOLS points to. In this case, when Python trys to compile, it will think it is using the 2010 tools, but it will actually be using the 2013 tools on your system (or whichever version of Visual Studio you have). Of course doing this could cause problems, but my guess is that everything will work just fine. Just be aware that if you ever experience problems, it could be due to using the wrong tools.

如果您有不同版本的 Visual Studio,上面的一位用户建议是一种解决方法。例如,我有一个 2013 版的 Visual Studio,因此我有一个名为“VS120COMNTOOLS”的变量,它指向 2013 年的工具集。由于 Visual Studio 的版本共享许多相同的工具,您可以使用更新或旧版本的 Visual Studio 编译 Python,只需添加一个名为“VS100COMNTOOLS”的新变量,其值为 %VS120COMNTOOLS%,或VS120COMNTOOLS 指向的目录。在这种情况下,当 Python 尝试编译时,它会认为它使用的是 2010 工具,但实际上它会在您的系统(或您拥有的任何版本的 Visual Studio)上使用 2013 工具。当然,这样做可能会导致问题,但我的猜测是一切都会正常进行。

The best method would be to install Visual Studio 2010 express (which is free I think).

最好的方法是安装 Visual Studio 2010 express(我认为是免费的)。