Index: Lib/distutils/sysconfig.py =================================================================== --- Lib/distutils/sysconfig.py (revision 64406) +++ Lib/distutils/sysconfig.py (working copy) @@ -72,15 +72,20 @@ prefix = plat_specific and EXEC_PREFIX or PREFIX if os.name == "posix": if python_build: - base = os.path.dirname(os.path.abspath(sys.executable)) + # Assume the executable is in the build directory. The + # pyconfig.h file should be in the same directory. Since + # the build directory may not be the source directory, we + # must use "srcdir" from the makefile to find the "Include" + # directory. + exedir = os.path.dirname(os.path.abspath(sys.executable)) if plat_specific: - inc_dir = base + return exedir else: - inc_dir = os.path.join(base, "Include") - if not os.path.exists(inc_dir): - inc_dir = os.path.join(os.path.dirname(base), "Include") - return inc_dir - return os.path.join(prefix, "include", "python" + get_python_version()) + incdir = os.path.join(get_config_var('srcdir'), 'Include') + return os.path.normpath(incdir) + else: + return os.path.join(prefix, "include", "python" + + get_python_version()) elif os.name == "nt": return os.path.join(prefix, "include") elif os.name == "mac":