Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
488 views
in Technique[技术] by (71.8m points)

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

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%SYSTEM32WBEM;%SYSTEMROOT%SYSTEM32WINDOWSPOWERSHELLV1.0;C:Program FilesWIDCOMMBluetooth Software;C:Python33;C:Python33Scripts;C:MinGWin;
  • I created distutils.cfg with the following lines

    [build]
    compiler=mingw32
    

In here:

C:Python33Libdistutilsdistutils.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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.0Common7Tools".

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...