How do I change the python shell version using pyenv?



  • Also see:
    pyenv help
    How do I install the python multiple version management tool pyenv?

    Version of the shell before the change.

    $ python
    Python 3.8.5 (default, Oct  8 2020, 13:36:54)
    [GCC 9.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> quit()
    

    Check the versions available.

    $ pyenv versions
      system
      2.7.15
      3.8.5
    * 3.8-dev (set by /home/trainer/demo_env/.python-version)
    

    Change the python shell to version 2.7.15

    $ pyenv shell 2.7.15
    

    Run python again. You can see it is now 2.7.15

    $ python
    Python 2.7.15 (default, Oct  8 2020, 14:02:01)
    [GCC 9.3.0] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>>
    

    Note: The shell command overrides local and global commands.

    To unset the shell use the --unset option.

    $ pyenv shell 3.8.5 --unset
    

Log in to reply
 

© Lightnetics 2024