askvity

How Do I Check Python on Raspberry Pi?

Published in Raspberry Pi Python 2 mins read

To check the Python version on your Raspberry Pi, open a terminal and use one of the following commands:

  • python -V
  • python --version

These commands will display the installed Python version (e.g., Python 2.7.16). If you want to check the version of Python 3, you'll usually need to specify python3:

  • python3 -V
  • python3 --version

This command will then output the installed Python 3 version (e.g., Python 3.7.3).

It's important to note that many Raspberry Pi systems come with both Python 2 and Python 3 installed. Therefore, specifying python might default to Python 2, especially on older systems. Using python3 ensures you're checking the version of the Python 3 interpreter.

You can also check the pip (package installer for Python) version using the commands:

  • pip -V
  • pip --version

And for pip3:

  • pip3 -V
  • pip3 --version

These commands will output the pip version and the Python interpreter it's associated with. This is helpful to ensure your pip version corresponds to the Python version you intend to use.

In summary, using the -V or --version flags with python or python3 is the standard way to check the installed Python version on a Raspberry Pi.

Related Articles