Home>

I want to change the version used by Python to 3.9.0.

I built python with pyenv.
I made settings from various tutorials.

Changed the reference python in pyenv.

$pyenv versions
  system
* 3.9.0 (set by /home/ubuntu/.pyenv/version)


Also, the execution path of python is as follows.

$which python
/home/ubuntu/.pyenv/shims/python
problem

But when I check the version of python,

$python --version
Python 3.6.9
$python
Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.


This way, different versions of python will be executed.

What went

I wrote the path of pyenv to bashrc.
But it didn't change.
I don't know what else to consider, so I'm stuck.
Anyone please help me.

  • Answer # 1

    In the current directory or the next higher directory.python-versionPlease check if there is a file called. If so, the version of Python written in that file will be used.

    $ls -a .python-version ../.python-version

    To be on the safe side, also check if the environment variable PYENV_VERSION is set. If so, the version of Python configured there will be used.

    $echo $PYENV_VERSION

    To be on the safe side, check the contents of .pyenv/version in your home directory. If the above files and environment variables are not present, the version of Python set here will be used.

    $cat ~/.pyenv/version

  • Answer # 2

    Check the .python-version file in the current directory.
    Here is the version.

Related articles