I have struggled with this exact issue in my py-js project (https://github.com/shakfu/py-js) which embeds a python3 interpreter in a max/msp plugin or in a relocatable folder (package) structure. For the latter case, Greg's solution, which is based on standard methods, has been absolutely crucial. Thank you!
I have found that trying to do the same with a python distro built with --enable-shared is basically impossible because in this case sys.prefix is hardcoded and it dos not respond (like the framework structure) to the same @rpath methods used by Greg.
It would be great for those who embed python for a fun or profit to have these issues addressed across all of the standard build structures. |