49.7k views
1 vote
How to check your Python version in cmd?

2 Answers

5 votes

Final answer:

To check your Python version in cmd, use the command 'python --version'. If you have multiple versions installed, you may need to specify the version. An error will occur if Python is not installed or not in the system path.

Step-by-step explanation:

To check your Python version in the command prompt (cmd), you can enter the following command:

python --version

This command will display the version of Python that is currently installed and accessible via your system path. If you have multiple versions of Python installed, you may need to specify the version you are inquiring about like so:

python3 --version

For Python 2.x, you can try:

python2 --version

If Python is not installed or not added to the system path, the command prompt will likely give an error indicating that Python was not found.

User Areefa
by
7.2k points
6 votes

Final answer:

To check your Python version in cmd, open the command prompt and type 'python --version'.

Step-by-step explanation:

For example, if you have Python 3.9.0 installed, the command prompt will display Python 3.9.0.

At the initial step, check whether an update is required. To check the existing version open the Terminal by pressing Ctrl+Alt+T and type the following command : python -V or python --version - You should get a similar output as shown below.

By default, Python installations on Windows are located in the C:\ directory or C:\Users\<User>\AppData\Local\Programs. The common installation paths for both 32-bit and 64-bit versions may reside in the C:\PythonXX folder, where XX stands for the Python version (e.g., C:\Python27 for Python 2.7).

Open a terminal window. Upgrade Python by executing the following command: sudo apt-get upgrade This command will upgrade Python to the default version in your distribution's package manager, which might be slightly behind the official release but is considered stable.

User Foad Rezek
by
8.0k points