How to run/compile a Python program


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.

  1. 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.
  2. 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
  3. To run the python program, try entering (after your directory): python project.py

0

More info: http://stackoverflow.com/questions/1522564/how-do-i-run-a-python-program

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s