This is a very short tutorial on how to run your Python programs using the command line. Because some editors don’t exactly have a compiler, therefore using the command prompt is an easy way to run your project.
- First, open up a command line or terminal (whichever you use for executing command prompt). So for Windows you would type ‘cmd’ in the search and it will open.
- Find where your python file or folder is, so for instance if your project folder is on the desktop, the directory would be something like C:\Users\YourAccountName>Desktop\Project Folder. To make it easier, enter:’ cd C:\Users\YourAccountName>Desktop\Project Folder’ (without quotes) so that the current directory will point to wherever your python file is located, therefore not needing to enter the entire directory over and over again to run a python file
- To run the python program, try entering (after your directory): python project.py