[UPDATE 2014-11-13] Free x86 and AMD64 (x86-64) VC90 c-compilers for Python-2.7 are now available from Microsoft. The free VC90 compilers can be used to install package source that contains c-extensions using either pip, setuptools or distutils. For example, pip install dulwich
will build and install the Python Git implementation which contains several speedups as c-extensions.
Previously in order to install Python-2.7 packages with extensions on my 64-bit Windows-7 machine, I have been using the Windows SDK-7 shell and setting the target and some environmental variables manually. What a drag! Then a few days ago, I discovered that the reason vcvarsall.bat
has been complaining that it can't find my x64 compilers, even tho they are right there in my Visual Studio 2008 VC folder is because the path the the batch file that sets up the environmental variables for the x64 compiler was wrong. In fact all of the paths were wrong except for vcvars32.bat
.
--- C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.txt | |
+++ C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat | |
@@ -16,23 +16,23 @@ | |
goto :eof | |
:amd64 | |
-if not exist "%~dp0bin\amd64\vcvarsamd64.bat" goto missing | |
-call "%~dp0bin\amd64\vcvarsamd64.bat" | |
+if not exist "%~dp0bin\vcvars64.bat" goto missing | |
+call "%~dp0bin\vcvars64.bat" | |
goto :eof | |
:ia64 | |
-if not exist "%~dp0bin\ia64\vcvarsia64.bat" goto missing | |
-call "%~dp0bin\ia64\vcvarsia64.bat" | |
+if not exist "%~dp0bin\vcvarsia64.bat" goto missing | |
+call "%~dp0bin\vcvarsia64.bat" | |
goto :eof | |
:x86_amd64 | |
-if not exist "%~dp0bin\x86_amd64\vcvarsx86_amd64.bat" goto missing | |
-call "%~dp0bin\x86_amd64\vcvarsx86_amd64.bat" | |
+if not exist "%~dp0bin\vcvarsx86_amd64.bat" goto missing | |
+call "%~dp0bin\vcvarsx86_amd64.bat" | |
goto :eof | |
:x86_ia64 | |
-if not exist "%~dp0bin\x86_ia64\vcvarsx86_ia64.bat" goto missing | |
-call "%~dp0bin\x86_ia64\vcvarsx86_ia64.bat" | |
+if not exist "%~dp0bin\vcvarsx86_ia64.bat" goto missing | |
+call "%~dp0bin\vcvarsx86_ia64.bat" | |
goto :eof | |
:usage |
@echo off | |
if "%1" == "" goto x86 | |
if not "%2" == "" goto usage | |
if /i %1 == x86 goto x86 | |
if /i %1 == amd64 goto amd64 | |
if /i %1 == x64 goto amd64 | |
if /i %1 == ia64 goto ia64 | |
if /i %1 == x86_amd64 goto x86_amd64 | |
if /i %1 == x86_ia64 goto x86_ia64 | |
goto usage | |
:x86 | |
if not exist "%~dp0bin\vcvars32.bat" goto missing | |
call "%~dp0bin\vcvars32.bat" | |
goto :eof | |
:amd64 | |
if not exist "%~dp0bin\amd64\vcvarsamd64.bat" goto missing | |
call "%~dp0bin\amd64\vcvarsamd64.bat" | |
goto :eof | |
:ia64 | |
if not exist "%~dp0bin\ia64\vcvarsia64.bat" goto missing | |
call "%~dp0bin\ia64\vcvarsia64.bat" | |
goto :eof | |
:x86_amd64 | |
if not exist "%~dp0bin\x86_amd64\vcvarsx86_amd64.bat" goto missing | |
call "%~dp0bin\x86_amd64\vcvarsx86_amd64.bat" | |
goto :eof | |
:x86_ia64 | |
if not exist "%~dp0bin\x86_ia64\vcvarsx86_ia64.bat" goto missing | |
call "%~dp0bin\x86_ia64\vcvarsx86_ia64.bat" | |
goto :eof | |
:usage | |
echo Error in script usage. The correct usage is: | |
echo %0 [option] | |
echo where [option] is: x86 ^| ia64 ^| amd64 ^| x86_amd64 ^| x86_ia64 | |
echo: | |
echo For example: | |
echo %0 x86_ia64 | |
goto :eof | |
:missing | |
echo The specified configuration type is missing. The tools for the | |
echo configuration might not be installed. | |
goto :eof |
Now to install packages that include extensions, EG: Dulwich, I just use pip install -U dulwich
and easy peasy!
No comments:
Post a Comment