[Python] Cannot switch Python with pyenv

Discussão em 'Python' iniciado por Stack, Maio 1, 2025.

  1. Stack

    Stack Membro Participativo

    I would like to use pyenv to switch python2 and python3. I successfully downloaded python2 and python3 and pyenv with following code.

    brew install pyenv
    brew install pyenv-virtualenv
    pyenv install 2.7.10
    pyenv install 3.5.0


    However, I cannot switch from python2 to python3:

    $ python --version
    Python 2.7.10
    $ pyenv global
    2.7.10
    $ pyenv versions
    system
    * 2.7.10 (set by /Users/Soma/.pyenv/version)
    3.5.0
    $ pyenv global 3.5.0
    $ pyenv global
    3.5.0
    $ pyenv versions
    system
    2.7.10
    * 3.5.0 (set by /Users/Soma/.pyenv/version)
    $ python --version
    Python 2.7.10


    I do not understand why this happens. My python is still in this directory.

    $ which python
    /usr/bin/python


    How do I switch to python3 correctly?

    Continue reading...

Compartilhe esta Página