A way to tell the embedded interpreter zip to look inside of user site-packages folder

In Windows there exists a user profile specific site-packages folder. I would like a value that I can append to my python311._pth / python312._pth file that allows using any packages installed from pip into that folder when the system installed python is used to install packages. I know for certain that it can be found it %AppData%\Python\Python311\site-packages. But is the embedded interpreter smart enough to resolve what %AppData% points to on Windows?

After testing it myself I discovered that environment variables used inside of the _pth files are not expanded/resolved. Perhaps that could be a feature for python to get in the future however.

This isn’t windows-specific BTW, but generally the folder only exists once something is installed to it.

It’s not about the interpreter; ._pth (aren’t they normally just .pth?) files have meaning because of the standard library. Anyway, these files have a custom format but in any case, whatever paths get found are added to sys.path directly, without any expansion.

At any rate: it’s not clear to me what exactly you mean by “the embedded interpreter zip”; but if you’re planning to distribute your project as some kind of archive with an embedded interpreter, consider that the user’s machine isn’t necessarily going to have the packages you want installed in that folder (or, for that matter, Python); and the user is probably not going to expect your code to look there and might not be happy about it.

Did you add import site to your ._pth?

I later on did and it worked. Thanks.