But sys.prefix is obtained from a search of the directory structure for a "landmark" file, namely os.py. When the Python library is in a zip file, it is likely that no landmark files will be found, and sys.prefix will contain garbage.
Good point! :)
Since sys.prefix is searched for, its name is unpredictable. We need a known location for python22.zip.
How about using the full path name of pythonXX.dll with the last three characters changed to "zip"? This associates the libraries with the DLL, which is more logical than associating them with the executable. And the file name is identical but with "zip" instead of "dll".
Does this work, and solve all embedding problems?
Sounds OK to me.