-
Notifications
You must be signed in to change notification settings - Fork 139
Question: how to set the embedded Python to virtualenv Python ? #71
Comments
#72 exposes |
Hi @sbinet , Unfortunately, this doesn't solve the problem (btw, I can't reopen an issue if it's closed by the repo collaborator). This is the code that I'm using to test:
For example, if the system Python is 2.7.14. Execute The method above is also what's suggested on docs.python.org/3: Very High Level Embedding. The only other possibility is Py_SetPythonHome, but I'm not sure whether that will work either. Any other thoughts or advice ? |
I can add the API for PythonHome. but I am quite doubtful this will help: |
Hi, Is there a plan on updating the project to be linked against CPython-3 to support Python3 ? Thanks! |
yes, there's a plan. I think I'll migrate this repo over to the go-python organization as, say (ultimately, the goal is to have a |
Thanks @sbinet |
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 with
virtualenv
it's quite nice too, because the libraries installed within the env won't have to be globally installed.I have tried to prefix the
PYTHON_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 on StackOverflow: 7492855 with (Python C API) was to set the program name via
Py_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.
The text was updated successfully, but these errors were encountered: