Unable to find vcvarsall.bat using Python 3.3 in W

2019-01-16 13:26发布

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?.

  • I installed MinGW with C++ compiler option checked
  • I added MinGW to my path

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
    

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.

Thanks for your help!

EDIT:

easy_install numpy

Works without a glitch.

5条回答
Evening l夕情丶
2楼-- · 2019-01-16 13:28

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

SET VS100COMNTOOLS=%VS110COMNTOOLS%

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

查看更多
一纸荒年 Trace。
3楼-- · 2019-01-16 13:34

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

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

查看更多
Root(大扎)
4楼-- · 2019-01-16 13:36

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

查看更多
Summer. ? 凉城
5楼-- · 2019-01-16 13:45

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

Ran the following in cmd tool

SET VS90COMNTOOLS=%VS110COMNTOOLS%

then used pip install

It worked.

查看更多
相关推荐>>
6楼-- · 2019-01-16 13:46

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).

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.

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\".

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.

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

查看更多
登录 后发表回答