Below we’ll cover how to check your Python version(s) using the command line interface (CLI). This will help you ensure you meet requirements for installing web applications that list Python as a dependency to run.
Keep in mind that Python is one the most popular programming languages today. That popularity comes from a lot of applications being built with it. There’s a good chance it is installed on more of your systems than you realize
How to Check Python Versions
First, log into the terminal or SSH. Then, run one of the following commands to view your default Python version:
python --version
python -V
If you type “python -v” (note the lowercase “v”), you’ll enter verbose logging mode. Type “quit()” to exit and try again.
If you have multiple Python versions installed, specify the major version in the command to receive the minor and micro version info for it. Using Python 3 as an example:
python3 -V
Python 3.6 and later include a new option which provides the version release date along with the current GNU Compiler Collection (GCC) release version:
python3 -VV
Python 3.6.9 (default, Dec 8 2021, 21:08:43) [GCC 8.4.0]
If you’re in the middle of coding a Python script, there are two modules you can use to get the same information without exiting:
import sys
print (sys.version)
import platform
print(platform.python_version())
Python 2.7 meets the requirements to support the Ansible IT automation engine. Our Cloud VPS and Dedicated hosting plans stay up to date for improved security and performance.
Your web application may have an option in the graphical interface to provide similar information
Want to learn more? We have a few articles that can help you make the most of your Python environment:
- Install Python 3.9 on a cPanel VPS
- Learn Python programming with free eBooks and training courses
With our Cloud Server Hosting, you can deploy a lightning-fast, reliable cloud platform with built-in redundancy – ensuring the availability of your environment!