So how would we get blender working with custom paths appended to PYTHONPATH? I see a lot of answers saying it was a problem for new users but haven’t found any working examples for experienced users.
For example, I have a tool that uses a venv and launches software from a GUI (Maya, Houdini, Nuke, etc). I’m able to launch every program with different versions of Python just by setting PYTHONHOME and add paths to PYTHONPATH env variables on launch, but this doesn’t seem to be allowed in Blender. I’ve found that adding paths to sys.path in my custom startup script works, but I’d rather pass env vars during subprocess.Popen.
Example: I’m trying to pass Qt dependencies so my script can call for them from Blender. Here’s what I’m trying with Blender:
# variables set up ^^^^^^
# Edit envs
_envs = os.environ.copy()
_envs['BLENDER_USER_SCRIPTS'] = scripts_path # This works and finds my custom startup.py script
_envs['PYTHONPATH'] += 'custom/abs/path'
# Launch software with custom envs
subprocess.Popen([exe_path, file_path , --python-use-system-env], envs=_envs )
What needs to be added to PYTHONPATH and what do I need to set PYTHONHOME to in order to use Blender’s python with a few paths added to it? Is this possible? Thanks!