[Python] How can I make a virtual environment work with pyenv?

Discussão em 'Python' iniciado por Stack, Fevereiro 8, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to use QGIS, which requires python 3.6.x.

    I'm on mac on a system that already has python 2.7 and 3.7.

    I tried

    brew update
    brew install pyenv
    brew install pyenv-virtualenv
    pyenv install 3.6.5


    It installs just fine. Then, when I try to activate

    pyenv activate my-virtualenv


    I get this error


    Failed to activate virtualenv.

    Perhaps pyenv-virtualenv has not been loaded into your shell properly. Please restart current shell and try again.
    ​

    I tried again with

    exec $SHELL
    pyenv activate my-virtualenv


    And received the same error.

    I executed this command in bash-3.2$ and regular terminal

    if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi


    And I'm still getting the same error. How can I get an environment running that uses python 3.6?

    Continue reading...

Compartilhe esta Página