Created
April 14, 2014 09:27
-
-
Save rebase-master/10631783 to your computer and use it in GitHub Desktop.
Installing C++ compilers for Python 2.7 libraries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you encounter errors like, "unable to find vcvarsall.bat" when installing Python dependencies, | |
you are probably missing C++ compilers needed to compile python libraries. To fix this issue, | |
install Micsrosoft Visual C++ 2008 redistributable 64 bit. | |
Building on the solution provided here: http://stackoverflow.com/a/18045219/888278 | |
Download specifically the Windows SDK for Windows 7 and .NET Framework 3.5 SP1 which gives you a x64 compiler for VC++ 2008 (VC++ 9.0) if you need it. | |
Note: If you have both a 32- and 64-bit Python installation, you may also want to use virtualenv to create separate Python environments to use one or the other at a time without messing with your path to choose which Python version to use. | |
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). | |
Execute: | |
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" | |
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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment