Index: Lib/sysconfig.py =================================================================== --- Lib/sysconfig.py (revision 78833) +++ Lib/sysconfig.py (working copy) @@ -84,7 +84,10 @@ _EXEC_PREFIX = os.path.normpath(sys.exec_prefix) _CONFIG_VARS = None _USER_BASE = None -_PROJECT_BASE = os.path.dirname(realpath(sys.executable)) +# Note: sys.executable can be '' or even a directory, until #7774 is fixed. +_PROJECT_BASE = realpath(sys.executable) +if not os.path.isdir(_PROJECT_BASE): + _PROJECT_BASE = os.path.dirname(_PROJECT_BASE) if os.name == "nt" and "pcbuild" in _PROJECT_BASE[-8:].lower(): _PROJECT_BASE = realpath(os.path.join(_PROJECT_BASE, pardir))