How To Run Python In Command Prompt
In this article I will show you how to run a Python program on the command prompt.
Step 0: Check That You’ve Installed Python
To easily check if you have python already installed on your computer, you can open the command prompt and check for a Python version. This will be good to also see what version of python you have if you do have python already installed.
Open the command prompt and type the following:
python --version
Note: I am using Python version 3.8.3
If you do not get back a python version then you will need to go to the python.org website to install python onto your computer.
Step 1: Create the Python Program File
Create your Python program. We will create a simple Python program using notepad that prints ‘Hello,World’ and save it as hello.py on the desktop.
print('Hello,World')
Step 2: Change Directories
Now that the hello.py file has been created, we will open up the command prompt and go to the directory that contains the python executable file.