{"action":"closed","issue":{"url":"https://api.github.com/repos/sbinet/go-python/issues/71","repository_url":"https://api.github.com/repos/sbinet/go-python","labels_url":"https://api.github.com/repos/sbinet/go-python/issues/71/labels{/name}","comments_url":"https://api.github.com/repos/sbinet/go-python/issues/71/comments","events_url":"https://api.github.com/repos/sbinet/go-python/issues/71/events","html_url":"https://github.com/sbinet/go-python/issues/71","id":347688878,"node_id":"MDU6SXNzdWUzNDc2ODg4Nzg=","number":71,"title":"Question: how to set the embedded Python to virtualenv Python ?","user":{"login":"sindbach","id":1203628,"node_id":"MDQ6VXNlcjEyMDM2Mjg=","avatar_url":"https://avatars1.githubusercontent.com/u/1203628?v=4","gravatar_id":"","url":"https://api.github.com/users/sindbach","html_url":"https://github.com/sindbach","followers_url":"https://api.github.com/users/sindbach/followers","following_url":"https://api.github.com/users/sindbach/following{/other_user}","gists_url":"https://api.github.com/users/sindbach/gists{/gist_id}","starred_url":"https://api.github.com/users/sindbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindbach/subscriptions","organizations_url":"https://api.github.com/users/sindbach/orgs","repos_url":"https://api.github.com/users/sindbach/repos","events_url":"https://api.github.com/users/sindbach/events{/privacy}","received_events_url":"https://api.github.com/users/sindbach/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-05T11:04:20Z","updated_at":"2018-08-06T09:26:35Z","closed_at":"2018-08-06T09:26:35Z","author_association":"NONE","body":"Hi, \r\nI'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. \r\n\r\nI have tried to prefix the `PYTHON_HOME` env variable with the `VIRTUAL_ENV` (Python bin) before `python.Initialize()`. However this seems to result in still picking the system Python 2.7.14. I can see the `PATH` env variable started with the correct `VIRTUAL_ENV` path, but the embedded Python once again is still picking up the system Python. \r\n\r\nOne of the suggested workarounds on [StackOverflow: 7492855](https://stackoverflow.com/questions/7492855/getting-an-embedded-python-runtime-to-use-the-current-active-virtualenv) 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. \r\n\r\nAnything suggestions ? or, perhaps I'm missing something quite obvious. \r\n\r\nThanks and regards,  \r\nWan."}}
{"actor":{"display_login":"sbinet"}}