Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jul 24, 2023. It is now read-only.
/go-pythonPublic archive
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Question: how to set the embedded Python to virtualenv Python ? #71

Closed
@sindbach

Description

@sindbach

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp