what I want to know

Where is the default version of python to launch by typing python3 in the console?
For example, in an environment where 3.6 is installed
apt install python3.7
I also installed 3.7 with python3.6 and python3.7,
When python3.6 starts by default.

Nothing is specified in .bashrc.

What I confirmed
  • Explicitly specify python3.7 to start 3.7
Usage environment, etc.
  • Windows 10 + WSL2 (Ubuntu-18.04)
  • Installed python3 version: python3.6, python3.7
  • VSCode: 1.51.1
  • Answer # 1

    >Where is the minor version number of python that starts by default specified?

    Nothing is specified in .bashrc.

    It is not specified.
    The entity when running python iswhich pythonYou can check with.
    Similarly for python 3.7which python3.7You can check with

    If you are forced to specify it, the environment variablePATHYou don't have to hit with a full pass because you have set

  • Answer # 2

    Since python3 is a symbolic link, there are many places to install it, so first check which python3 is running.which python3Let's check with.

    What is the entity of python3 being executed?ls -l full path to python3 aboveIn can be confirmed.

    After all, which python3 is executed is determined by the path search order of the shell, so if you look at the contents of ~/.bashrc and ~/.bash_profile, the "criminal" who controls the execution order is I understand. In addition, it is difficult to find the "black curtain" of why this "criminal" is happening because it changes depending on the past installation order and installation method of python.

    The situation becomes even more complicated when using a python virtual environment.

  • Answer # 3

    Although it is a debian environment

    $cd/usr/bin /
    / user/bin $ls -l python3

    Should be displayed (3.7 in my case)
    This will be the python version associated with python3