Installing SetupTools on 64-bit Windows
Apparently (having faced related 64- and 32-bit issues on OS X) there is a bug in the Windows installer. I stumbled across this workaround, which might help - basically, you create your own registry value HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.6\InstallPath
and copy over the InstallPath value from HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\InstallPath
. See the answer below for more details.
If you do this, beware that setuptools may only install 32-bit libraries.
NOTE: the responses below offer more detail, so please read them too.
Problem: you have 64-bit Python, and a 32-bit installer. This will cause problems for extension modules.
The reasons why the installer doesn't finds Python is the transparent 32-bit emulation from Windows 7. 64-bit and 32-bit programs will write to different parts of the Windows registry.
64-bit: HKLM|HKCU\SOFTWARE\
32-bit: HKLM|HKCU\SOFTWARE\wow6432node\
.
This means that the 64-bit Python installer writes to HKLM\SOFTWARE\Python
, but the 32-bit setuptools installer looks at HKLM\SOFTWARE\wow6432node\Python
(this is handled by windows automatically, programs don't notice). This is expected behavior and not a bug.
Usually, you have these choices:
- the "clean" way: use 32-bit Python if you have to use 32-bit modules or extensions
- the other "clean" way: only use 64-bit installers when using 64-bit Python (see below)
- what the answer above suggests: copy
HKLM\SOFTWARE\Python
toHKLM\SOFTWARE\wow6432node\Python
, but this will cause problems with binary distributions, as 64-bit Python can't load 32-bit compiled modules (do NOT do this!) - install pure Python modules with setuptools instead of the distutils installer (easy_install or pip)
For setuptools itself, for example, you can't use a 32-bit installer for 64-bit Python as it includes binary files. But there's a 64-bit installer at http://www.lfd.uci.edu/~gohlke/pythonlibs/ (has many installers for other modules too). Nowadays, many packages on PyPi have binary distributions, so you can install them via pip.