Sorry for the delay:
On Windows, the directory is the directory of sys.executable.
Any chance this can be in sys.prefix, else the directory of sys.executable if sys.prefix is empty?
The reason is for embedding situations - sys.executable may not be a reasonable watermark. We recently had a bug regarding os.popen() on Windows for the exact same reason, and a patch was recently checked in that goes to great lengths to ensure sys.prefix is always valid even in these embedding situations.