Which version of Python do I have installed?
There are several ways to check the version of Python installed on your system:
1. Using thepython
Command:
python -V
This command displays the version of Python installed on your system. For example, if you have Python 3.9.6 installed, running this command will output:
Python 3.9.6
2. Using the --version
Option:
python --version
This command also displays the version of Python installed on your system. It is functionally equivalent to the python -V
command.
python -VV
Command:
python -VV
This command displays the version of Python installed on your system along with additional information, such as the version of the Python interpreter and the location of the Python binary.
4. Using thesys.version
Attribute:
python -c "import sys; print(sys.version)"
This command uses the sys.version
attribute to display the version of Python installed on your system.
pyenv
(if installed):
pyenv versions
If you have pyenv
installed, you can use this command to list all the Python versions installed on your system.
py
instead of python
.