conda – What is the difference between !python –version and sys.version for Google Colab?

I tried to install miniconda on Google Colab with different version of Python. But I cannot figure out why !python --version will be changed to 3.6.0 and sys.version stays the same as the default Python version from Google Colab. I ran the same codes on Kaggle Notebook. Kaggle will always return the same Python version number. Can anyone explain to me?

Here are the codes I ran on Google Colab.

from google.colab import drive
drive.mount('/content/drive')

After mounting, the below 3 lines of codes will return Python 3.8.10 twice.

import sys
!python --version
print('\npython:', sys.version)

But after I installed miniconda with python 3.6 by the following 4 lines of codes, the above 3 lines of codes will return Python 3.6.0 and python 3.8.10.

%env PYTHONPATH=
! wget https://repo.anaconda.com/miniconda/Miniconda3-4.3.11-Linux-x86_64.sh
! chmod +x Miniconda3-4.3.11-Linux-x86_64.sh
! bash ./Miniconda3-4.3.11-Linux-x86_64.sh -b -f -p /usr/local/

I suppose miniconda cannot change the Python version of Google Colab but it seems like miniconda did do some changes. Or, I did not understand the meaning of !python --version correctly?

Read more here: Source link