- Notifications
You must be signed in to change notification settings - Fork139
Question: how to set the embedded Python to virtualenv Python ? #71
Description
Hi,
I'm trying to write a Go executable that is able to pick up whichever Python version (hence libraries) it's running on. For example, in macOS the default system Python is 2.7.14, but could be executed within Python 3.6.5 virtualenv. As you know, working withvirtualenv
it's quite nice too, because the libraries installed within the env won't have to be globally installed.
I have tried to prefix thePYTHON_HOME
env variable with theVIRTUAL_ENV
(Python bin) beforepython.Initialize()
. However this seems to result in still picking the system Python 2.7.14. I can see thePATH
env variable started with the correctVIRTUAL_ENV
path, but the embedded Python once again is still picking up the system Python.
One of the suggested workarounds onStackOverflow: 7492855 with (Python C API) was to set the program name viaPy_SetProgramName
. Although I don't seem to be able to find this function on go-python.
Anything suggestions ? or, perhaps I'm missing something quite obvious.
Thanks and regards,
Wan.