Installing SetupTools on 64-bit Windows Ask Question

Installing SetupTools on 64-bit Windows Ask Question

I'm running Python 2.7 on Windows 7 64-bit, and when I run the installer for setuptools it tells me that Python 2.7 is not installed. The specific error message is:

`Python Version 2.7 required which was not found in the registry`

My installed version of Python is:

`Python 2.7 (r27:82525, Jul  4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win32`

I'm looking at the setuptools site and it doesn't mention any installers for 64-bit Windows. Have I missed something or do I have to install this from source?

ベストアンサー1

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
  • 他の「クリーンな」方法: 64 ビット Python を使用する場合は 64 ビット インストーラーのみを使用する (以下を参照)
  • 上記の回答が示唆していること:HKLM\SOFTWARE\PythonにコピーしますHKLM\SOFTWARE\wow6432node\Pythonが、これは意思64 ビット Python は 32 ビットでコンパイルされたモジュールをロードできないため、バイナリ配布で問題が発生します (これを行わないでください)。
  • distutilsインストーラ(easy_installまたはpip)の代わりにsetuptoolsを使用して純粋なPythonモジュールをインストールする

たとえば、setuptools 自体にはバイナリ ファイルが含まれているため、64 ビット Python 用の 32 ビット インストーラーは使用できません。しかし、64ビットインストーラーはhttp://www.lfd.uci.edu/~gohlke/pythonlibs/(他のモジュール用のインストーラーも多数あります)現在、PyPi の多くのパッケージにはバイナリ配布があるため、pip 経由でインストールできます。

おすすめ記事