win8 红警安装 error:unable to set themipi video modee

python - error: Unable to find vcvarsall.bat - Stack Overflow
to customize your list.
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
J it only takes a minute:
Join the Stack Overflow community to:
Ask programming questions
Answer and help your peers
Get recognized for your expertise
I tried to install the Python package :
pip install dulwich
But I get a cryptic error message:
error: Unable to find vcvarsall.bat
The same happens if I try installing the package manually:
& python setup.py install
running build_ext
building 'dulwich._objects' extension
error: Unable to find vcvarsall.bat
4,069105196
Update: Comments point out that the instructions here may be dangerous. Consider using the Visual C++ 2008 Express edition or the purpose-built
() and NOT using the original answer below. Original error message means the required version of Visual C++ is not installed.
For Windows installations:
While running setup.py for package installations, Python 2.7 searches for an installed Visual Studio 2008. You can trick Python to use a newer Visual Studio by setting the correct path in VS90COMNTOOLS environment variable before calling setup.py.
Execute the following command based on the version of Visual Studio installed:
Visual Studio 2010 (VS10): SET VS90COMNTOOLS=%VS100COMNTOOLS%
Visual Studio 2012 (VS11): SET VS90COMNTOOLS=%VS110COMNTOOLS%
Visual Studio 2013 (VS12): SET VS90COMNTOOLS=%VS120COMNTOOLS%
23.9k63456
6,97611223
I found the solution.
I had the exact same problem, and error, installing 'amara'. I had mingw32 installed, but distutils needed to be configured.
I have Python 2.6 that was already installed.
I installed mingw32 to C:\programs\mingw\
Add mingw32's bin directory to your environment variable: append c:\programs\MinGW\ to the PATH
Edit (create if not existing) distutils.cfg file located at C:\Python26\Lib\distutils\distutils.cfg to be:
compiler=mingw32
Now run easy_install.exe amara.
Make sure environment is set by opening a new cmd.exe.
4,72351136
You can install compiled version from
At least I found my solution from drawing feedback from other answers using the Visual
Studio C++ compilers rather than installing through the mingw32 path.
Important Note:
If you are using a Python version more recent than Python 2.7 (especially any Python 3.x), you most likely need a version of Visual Studio C++ other than the 2008 version.
See bottom for details.
Download and install specifically
(unless are following the note at the top).
Update for x64 Compilers: By default this will only give you a 32-bit compiler. I learned (from
and ) that you can download specifically the
which gives you a x64 compiler for VC++ 2008 (VC++ 9.0) if you need it. Just when you are installed it, you can uncheck everything except Developer Tools && Visual C++ Compilers which will keep you from installing all the extra SDK tools that you may not need.
dr: If you want the x64 compilers for VC++ 2008, download specifically the
and uncheck everything except Developer Tools && Visual C++ Compilers during install.
Note: If you have both a 32- and 64-bit Python installation, you may also want to use
to create separate Python environments so you can use one or the other at a time without messing with your path to choose which Python version to use.
Note: Apparently, you may be able to skip all of this by copying a few batch files according to @srodriguex following . If that works great, otherwise, here is at least what worked for me.
Open up a cmd.exe
Before you try installing something which requires C extensions, run the following batch file to load the VC++ compiler's environment into the session (i.e. environment variables, the path to the compiler, etc).
32-bit Compilers:
Note: 32-bit Windows installs will only have C:\Program Files\ as expected
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat"
64-bit Compilers:
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\vsvars64.bat"
Note: Yes, the native 64-bit compilers are in Program Files (x86). Don't ask me why.
Additionally, if you are wondering what the difference between vcvars64.bat and vcvarsx86_amd64.bat or more importantly the difference between amd64 and x86_amd64, the former are for the native 64-bit compiler tools and the latter are the 64-bit cross compilers that can run on a 32-bit Windows installation.
If for some reason you are getting error: ... was unexpected at this time. where the ... is some series of characters, then you need to check that you path variable does not have any extraneous characters like extra quotations or stray characters. The batch file is not going to be able to update your session path if it can't make sense of it in the first place.
If that went well, you should get one of the following messages depending on which command you ran:
For the 32-bit compiler tools:
Setting environment for using Microsoft Visual Studio 2008 x86 tools.
For the 64-bit compiler tools:
Setting environment for using Microsoft Visual Studio 2008 x64 tools.
Now, run the setup via python setup.py install or pip install pkg-name
Hope and cross your fingers that the compiler actually works today.
Finding the correct version of VC++ to use
Newer versions of Python (at least ) are compiled using newer versions of Visual C++, as shown in this screenshot. It is important to use the correct version of Visual C++ so that the compiled library will work with your Python version.
Yellow (top) is Python 3.4.1, it uses MSC v.1600 ()
Red (bottom) is Python 2.7, it uses MSC v.1500 ()
' get_build_version prevents mixing (), you may need to download the corresponding version of Visual Studio.
In other words, above will work only if on launching Python interpreter, you see MSC v.1500.
which corresponds to Python 3.4.1's MSCv.1600.
I just had this same problem, so I'll tell my story here hoping it helps someone else with the same issues and save them the couple of hours I just spent:
I have mingw (g++ (GCC) 4.6.1) and python 2.7.3 in a windows 7 box and I'm trying to install PyCrypto.
It all started with this error when running setup.py install:
error: Unable to find vcvarsall.bat
Easily solved after googling the error by specifying mingw as the compiler of choice:
setup.py install build --compiler=mingw32
The problem is that then I got a different error:
configure: error: cannot run C compiled programs.
It turns out that my anti-virus was blocking the execution of a freshly compiled .exe. I just disabled the anti-virus "resident shield" and went to the next error:
cc1.exe: error: unrecognized command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1
This solved it: "Either install a slightly older version of MinGW, or edit distutils\cygwinccompiler.py in your Python directory to remove all instances of -mno-cygwin." (from )
Now, I can finally start working.
120k13162238
What's going on? Python modules can be
(typically for speed). If you try to install such a package with Pip (or setup.py), it has to compile that C/C++ from source. Out the box, Pip will brazenly assume you the compiler Microsoft Visual C++ installed. If you don't have it, you'll see this cryptic error message "Error: Unable to find vcvarsall.bat".
The prescribed solution is to install a C/C++ compiler, either Microsoft Visual C++, or
(an open-source project). However, installing and configuring either is prohibitively difficult. (Edit 2014: Microsoft have published a special
for Python 2.7)
The easiest solution is to use Christoph Gohlke's Windows installers (.msi) for popular Python packages. He builds installers for Python 2.x and 3.x, 32 bit and 64 bit. You can download them from
If you too think "Error: Unable to find vcvarsall.bat" is a ludicrously cryptic and unhelpful message, then please comment on the bug at
to replace it with a more helpful and user-friendly message.
For comparison, Ruby ships with a package manager Gem and offers a quasi-official C/C++ compiler, DevKit. If you try to install a package without it, you see this helpful friendly useful message:
Please update your PATH to include build tools or download the DevKit from
and follow the instructions at
You can read a longer rant about Python packaging at
41.4k23179233
You'll need to install a Microsoft compiler, compatible with the compiler used to build Python. This means you need Visual C++ 2008 (or newer, with ).
Microsoft now supplies a bundled compiler and headers just to be able to compile Python extensions, at the memorable URL:
Microsoft Visual C++ Compiler for Python 2.7
This is a rela 85MB to download, installable without admin privileges, no reboot required. The name is a little misleading, the compiler will work for any Python version originally compiled with Visual C++ 2008, not just Python 2.7.
If you start a Python interactive prompt or print sys.version, look for the MSC if it is MSC v.1500 you can use this tool.
From the :
Microsoft has released a compiler package for Python 2.7 to make it easier for people to build and distribute their C extension modules on Windows. The Microsoft Visual C++ Compiler for Python 2.7 (a.k.a. VC9) is available from:
This package contains all the tools and headers required to build C extension modules for Python 2.7 32-bit and 64-bit (note that some extension modules require 3rd party dependencies such as OpenSSL or libxml2 that are not included). Other versions of Python built with Visual C++ 2008 are also supported, so "Python 2.7" is just advertising - it'll work fine with 2.6 and 3.2.
Note that you need to have
installed (listed in the system requirements on the download page). The project you are installing must use setuptools.setup(), not distutils or the auto-detection won't work.
Microsoft has stated that they want to keep the URL stable, so that automated scripts can reference it easily.
429k489521138
I have python 2.73 and windows 7 .The solution that worked for me was:
Added mingw32's bin directory to environment variable: append PATH with C:\programs\mingw\
Created distutils.cfg located at C:\Python27\Lib\distutils\distutils.cfg containing:
compiler=mingw32
To deal with MinGW not recognizing the -mno-cygwin flag anymore, remove the flag in C:\Python27\Lib\distutils\cygwincompiler.py line 322 to 326, so it looks like this:
self.set_executables(compiler='gcc -O -Wall',
compiler_so='gcc -mdll -O -Wall',
compiler_cxx='g++ -O -Wall',
linker_exe='gcc',
linker_so='%s %s %s'
% (self.linker_dll, shared_option,
entry_point))
3,411844100
Looks like its looking for VC compilers, so you could try to mention compiler type with -c mingw32, since you have msys
python setup.py install -c mingw32
55.4k13109165
I tried all the above answers, and found all of them not to work, this was perhaps I was using Windows 8 and had installed Visual Studio 2012. In this case, this is what you do.
The vcvarsall.bat file is located here:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC
Simply select the file, and copy it.
Then go to this directory:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools
and paste the file. And then, all should be well.
21.1k1358108
Maybe somebody can be interested, the following worked for me for the py2exe package.
(I have windows 7 64 bit and portable python 2.7, Visual Studio 2005 Express with Windows SDK for Windows 7 and .NET Framework 4)
set VS90COMNTOOLS=%VS80COMNTOOLS%
python.exe setup.py install
120k13162238
You can download the free Visual C++ 2008 Express Edition from , which will set the VS90COMNTOOLS environment variable during installation and therefore build with a compatible compiler.
As @PiotrDobrogost mentioned in a comment, his answer to this other question goes into details about why Visual C++ 2008 is the right thing to build with, but this can change as the Windows build of Python moves to newer versions of Visual Studio:
Look in the setup.py file of the package you are trying to install. If it is an older package it may be importing distutils.core.setup() rather than setuptools.setup().
I ran in to this (in 2015) with a combination of these factors:
The Microsoft Visual C++ Compiler for Python 2.7 from
An older package that uses distutils.core.setup()
Trying to do python setup.py build rather than using pip.
If you use a recent version of pip, it will force (monkeypatch) the package to use setuptools, even if its setup.py calls for distutils. However, if you are not using pip, and instead are just doing python setup.py build, the build process will use distutils.core.setup(), which does not know about the compiler install location.
Step 1: Open the appropriate Visual C++ 2008 Command Prompt
Open the Start menu or Start screen, and search for "Visual C++ 2008 32-bit Command Prompt" (if your python is 32-bit) or "Visual C++ 2008 64-bit Command Prompt" (if your python is 64-bit). Run it. The command prompt should say Visual C++ 2008 ... in the title bar.
Step 2: Set environment variables
Set these environment variables in the command prompt you just opened.
SET DISTUTILS_USE_SDK=1
SET MSSdk=1
Step 3: Build and install
cd to the package you want to build, and run python setup.py build, then python setup.py install. If you want to install in to a virtualenv, activate it before you build.
I had this problem using Python 3.4.1 on Windows 7 x64, and unfortunately the packages I needed didn't have suitable exe or wheels that I could use. This system requires a few 'workarounds', which are detailed below (and TLDR at bottom).
Using the info in , I determined I needed Visual Studio C++ 2010 (sys.version return MSC v.1600), so I installed Visual C++ 2010 Express from the link in his answer, which is . I installed everything with updates, but as you can read below, this was a mistake. Only the original version of Express should be installed at this time (no updated anything).
vcvarsall.bat was now present, but there was a new error when installing the package, query_vcvarsall
raise ValueError(str(list(result.keys())))ValueError: [u'path']. There are other stackoverflow questions with this error, such as
I determined from that answer that 2010 Express only installs 32-bit compilers. To get 64-bit (and other) compilers, you need to install Windows 7.1 SDK. See
This would not install for me though, and the installer returned the error installation failed with return code 5100. I found the solution at the following link: . In short, if newer versions of x86 and x64 Microsoft Visual C++ 2010 Redistributable's are installed, they conflict with the ones in SDK installer, and need uninstalling first.
The SDK then installed, but I noticed vcvars64.bat still did not exist in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin, nor its subfolders. vcvarsall.bat runs the vcvars64 batch file, so without it, the python package still wouldn't install (I forgot the error that was shown at this time).
I then found some instructions here:
Following the instructions, I had already installed Express and 7.1 SDK, so installed SDK 7.1 SP1, and did the missing header file fix. I then manually created vcvars64.bat with the content CALL setenv /x64. I will paste all those instructions here, so they don't get lost.
Step 1 is to download Visual Studio Express 2010.
is a good place to start. Download the installer, and run it
(vc_web.exe). You don't need the SQL 2008 additional download.
You'll also need the Windows SDK (currently 7.1) for the 64-bit
compilers - unless you want to do 32-bit only builds, which are not
fully supported...
starting point to download this - you'll want to run winsdk_web.exe
when downloaded!
The default install here is just fine.
Finally, download and install the Windows SDK 7.1 SP1 update:
And, to fix missing header file, VS2010 SP1.
And, bloody hell, fix the missing batch file for VS2010 Express. This
is getting downright absurd.
In C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64,
create "vcvars64.bat" with the following (you will need to be running
as administrator):
CALL setenv /x64
My python package still did not install (can't recall error). I then found some instructions (copied below) to use the special SDK 7.1 Command Prompt, see:
Never mind this question.
Somebody here noticed this item on the menu:
Start->All Programs->Microsoft Windows SDK v7.1 ->Windows SDK 7.1 Command Prompt
This runs a batch job that appears to set up a working environment for the compiler.
From that prompt, you can type "setup.py build" or "setup.py install".
I opened the Windows SDK 7.1 Command Prompt as instructed, and used it to run easy_install on the python package. And at last, success!
Install Visual Studio Express 2010 (preferably without updated redistributables or SQL server).
Install Windows 7.1 SDK
Instal SDK 7.1 SP1 update, and VS2010 SP1 header file fix (this step may not be required).
Manually create C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvars64.bat with content CALL setenv /x64
Start->All Programs->Microsoft Windows SDK v7.1 ->Windows SDK 7.1 Command Prompt to open special x64 command prompt, which can then be used with python/easy_install/pip/etc (including those in virtual_envs).
I tried many solutions but only one worked for me, the install of Microsoft Visual Studio 2008 Express C++.
I got this issue with a Python 2.7 module written in C (yEnc, which has other issues with MS VS). Note that Python 2.7 is built with MS VS 2008 version, not 2010!
Despite the fact it's free, it is quite hard to find since MS is promoting VS 2010.
Still, the MSDN official very direct links are still working: check
for download links.
3,99611832
I spent almost 2 days figuring out how to fix this problem in my python 3.4 64 bit version: Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 :40) [MSC v.1600 64 bit (AMD64)] on win32
Solution 1, hard: (before reading this, read first Solution 2 below)
Finally, this is what helped me:
create manually file vcvars64.bat in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64 which contains CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 or other path depending on where you have yours installed
(this seems to be optional) install
together with
after that I tried to pip install numpy but received the following error:
File "numpy\core\setup.py", line 686, in get_mathlib_info
raise RuntimeError("Broken toolchain: cannot link a simple C program")
RuntimeError: Broken toolchain: cannot link a simple C program
I changed mfinfo to None in C:\Python34\Lib\distutils\msvc9compiler.py per this
finally after pip install numpy command my avast antivirus tried to interfere into the installation process, but i quickly disabled it
It took very long - several minutes for numpy to compile, I even thought that there was an error, but finally everything was ok.
Solution 2, easy:
(I know this approach has already been mentioned in a highly voted , but let me repeat since it really is easier)
After going through all of this work I understood that the best way for me is just to use already precompiled binaries from
in future. There is very small chance that I will ever need some package (or a version of a package) which this site doesn't contain. The installation process is also much quicker this way. For example, to install numpy:
donwload numpy-1.9.2+mkl-cp34-none-win_amd64.whl (if you have Python 3.4 64-bit) from that site
in command prompt or powershell install it with pip pip install numpy-1.9.2+mkl-cp34-none-win_amd64.whl (or full path to the file depending how command prompt is opened)
You can use easy_install instead of pip it works for me.
If you have mingw installed
pip install --global-option build_ext --global-option --compiler=mingw32 packagename
works, forcing pip to build using the mingw compiler instead of Microsoft's. See here
for details (last post).
I wanted to run pysph on Windows 10 under Python 2.7 and got vcvarsall.bat was not found (from distutils)
My solution was the following:
Install Microsoft Visual C++ for Python 2.7 (like @Michael suggested)
On Windows 10 it was installed into (my username is Andreas):
C:\Users\Andreas\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0
Set environment variable VS90COMNTOOLS to the installation path of Visual C++ for Python 2.7 (see above path).
If it still doesn't work, then modifiy in the module
C:/Python27/lib/distutils
the file msvc9compiler.py. Find in it the function find_vcvarsall and do following modification.
Replace the line:
productdir = os.path.join(toolsdir, os.pardir, os.pardir, "VC")
productdir = os.path.join(toolsdir)
This is where vcvarsall.bat resides in my case (check, where vcvarsall.bat is in your installation).
If you're looking to install pyodbc on a Windows box that doesn't have Visual Studio installed another option is to manually install pyodbc using the binary distribution.
This is particularly useful if you do not have administrator privileges on the machine you're working with and are trying to set up a .
Download the latest Windows installer from
(pyodbc-X.X.X.win-Y-py2.7.exe)
Open the installer executable using 7-Zip (or WinRAR or whatever)
Extract pyodbc.pyd and pyodbc-X.X.X-py2.7.egg-info and place them in [python installation directory or virtualenv]\Lib\site-packages
There is no step 4 :)
With Python 3.4, the dependency is on Visual Studio 2010. Installing Visual C++ 2010 Express fixed the problem for me.
Tricking it into using the VS 2008 or 2013 installs that I happened to have didn't work.
The answer given by @monkey is one of the correct ones, but it is incomplete.
In case you'd like to use , you should select the C, C++ and also other development tools suggested during the MinGW installation process to also get "make.exe."
You must also have the path set to make.exe in the env.
To complete his answer, here are the steps:
Add mingw32's bin directory to your environment variables
Append C:\Programs\MinGW\C:\Programs\MinGW\msys\1.0\ to the PATH
Edit (create if it doesn't exist) the distutils.cfg file located at C:\Python26\Lib\distutils\distutils.cfg to be:
compiler=mingw32
Make sure the environment variables is set by opening a new cmd.exe.
9,244106498
fastest solution:
If you have python 3.4.x, the solution is simply to install
VC++ 2010 since it is used to compile itself into.
my python version is
MSC v.1600 32 bit (intel)] on win32
worked fine on Windows8
There are instructions to install anaconda which will provide a GUI and a silent install of a majority of the packages that seem to be causing this issue from .
I am aware of the solution for 2.7 here
but I did not see an option for Python 3.4.
After downloading and installing Anaconda you should be able to import a majority of the packages you need from scipy.
Hope this helps some people.
Took me 45 minutes of scouring posts and sites.
EDIT: Just wanted to note there is a Python34 link on the GUI page next to the OS symbols.
Install Visual Studio 2015 Community Edition from ,
for Python 3.4
set VS100COMNTOOLS=%VS140COMNTOOLS% && pip install XX
I don't know if it is too late, but I found
which reads
The typical error message you will receive if you need this compiler package is Unable to find vcvarsall.bat
Hope this helps!
Is Microsoft Visual C++ Compiler for Python 2.7 at
not a solution?
I had the same error (which I find silly and not really helpful whatsoever as error messages go) and continued having problems, despite having a C compiler available.
Surprising, what ended up working for me was simply upgrading pip and setuptools to the most recent version. Hope this helps someone else out there.
I followed the instructions . but nothing happened.
Then I installed 2010 Visual Studio Express () following the advice
it helped me
I encountered this issue when I tried to install numpy library on my python 3.5. The solution is to install VS2015. I had VS, 2013, none of which is compatible with python 3.5. Apparently newer version of python has dependency on newer versions of VS.
protected by ♦
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10
on this site.
Would you like to answer one of these
Not the answer you're looking for?
Browse other questions tagged
Upcoming Events
The week's top questions and answers
Important community announcements
Questions that need answers
By subscribing, you agree to the
Stack Overflow works best with JavaScript enabled}

我要回帖

更多关于 红警video 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信