To check your Python version in Google’s Colab, type !python ββversion
using the exclamation mark !
operator in your Jupyter Notebook cell and click on the “Run” icon. After a couple of seconds an output like Python 3.9 will appear, depending on the version you’ve installed.
In Jupyter notebooks, the exclamation mark !
executes commands from the underlying operating system.
π‘ Recommended Tutorial: Whatβs the Meaning of the Exclamation Mark in a Jupyter Notebook?
Feel free to try it yourself in our Colab Jupyter Notebook created for this tutorial:
By the way, there are some alternatives to checking your Python version in your script. I’d recommend you check out our deep dive on the Finxter blog as well.
For example, the following approach using the sys
library can also help you check out the version of your Python in Colab:
import sys print(sys.version)
Summary: To check the Python version in your Jupyter Colab Notebook, do any of the following:
!python ββversion
import sys; print(sys.version)
Thanks for reading the whole article, feel free to join our community of like-minded and ambitious coders — and download our Python cheat sheets!