I was trying to install psutil (on which my own script depends) on a computer that does not have Visual Studio 2008, so I get the "Unable to find vcvarsall.bat" error. I don't have mingw32 either. I tried installing the precompiled version for Python 2.7, but it searches the registry, finds Python installed in C:\Python2.7\ and tries to install it there without allowing me to change the install path.
I used virtualenv to create a virtual environment from my Python 2.7 in a dir c:\MyVitualEnv, and that's where I want to install psutil. Is there a way to do it?
I had to solve this problem with psycopg2 and gdal. Use easy_install from your virtualenv with the executable as the argument. I'll pretend the file psutil-0.7.0.win32-py2.7.exe is in C:\ for the sake of an example. On the command prompt,
C:\> C:\MyVitualEnv\Scripts\activate.bat
(MyVitualEnv) C:\> easy_install psutil-0.7.0.win32-py2.7.exe
activate.bat
just sets up the environment to use the virtualenv, so the call to easy_install
will find C:\MyVitualEnv\Scripts\easy_install
and a number of other appropriate environment variables will be set.
You can even use pip to uninstall it later:
(MyVitualEnv) C:\> pip uninstall psutil
Note: You can't use pip to do the install. Only easy_install works.
Seems to work with both setuptools and distribute, although I haven't actually tried to use a library after doing this with distribute.
I think this works because the executable is really just a zip file containing some well known file structure. (Perhaps the internal structure of the executable is the same as an egg file.) There must be some kind of standard way of building these binaries, and that method produces these "easy_install compatible" executables. I can't tell you what the details of that process are, though. If someone could enlighten me, I'd be happy to add it to this answer.
Enjoy!