Link Search Menu Expand Document

Table of contents

  1. General Instructions to Install Python
    1. Mac users NOTE
    2. Windows users:
  2. How to install the Python Interpreter on a Windows machine?
    1. Step 1. Go to python.org
    2. Step 2. Download the latest version
    3. Step 3. Find and run the installer
    4. Step 4. IMPORTANT!
      1. Add Python to the PATH
      2. Save the Python path
    5. Step 5. Install
    6. Step 6. Celebrate or Troubleshoot
  3. How to use IDLE with files?
    1. Warning!
    2. Create a new Python file in IDLE
    3. Running a file that asks for user input
  4. Helpful notes
    1. Enable line numbers
    2. Force the program to stop
    3. Function prompts

General Instructions to Install Python

  1. Go to https://www.python.org/
  2. Roll over the Downloads link on the top blue bar. You should get a button to download the version for your operating system.
  3. Be sure to choose the latest Python version that starts with 3.
  4. Double-click the downloaded file to install. Follow all instructions.

Mac users NOTE

At the end of the install, click on Install Certificates to install a set of current SSL root certificates. (See screenshots.)

Mac users: You can click yes when it asks to move the installer to the Trash.

Windows users:

Look carefully for any option to “add Python to PATH” - You DO want to do this — so if a box needs to be checked, check it.

If you need the step-by-step instructions on how to install your very first Python interpreter on a Windows machine, then read on.

Skip to “How to use IDLE with files?” below if you are ready to get started with IDLE.


How to install the Python Interpreter on a Windows machine?

If you have other types of OS (e.g., Linux, Mac), your process can slightly differ from these instructions. Feel free to look it up online or ask us for help during the office hours.

Step 1. Go to python.org

Open your browser and go to https://www.python.org/download

Step 2. Download the latest version

Click on the button “Download Python 3.10.X” - the specific version can change, so do not worry about it, as long as it is greater than 3.7.

Pressing the “Python 3.10.X” button will initiate the downloading process for the python installer (python installer != python interpreter).

If your browser asks you if you want to download this .exe file - choose “yes”.

If the browser asks you for the place to save this file - choose any folder, it is not important. (We suggest the “Downloads” folder)

Check that you see the process in your browser.

'A screenshot of showing the python exe file downloading in the browser.'

Wait until the file finishes downloading - it might take a few minutes.

Step 3. Find and run the installer

Find it on your computer or in your browser (see the previous picture) and double-click on it to run it.

You should have the result, similar to the picture below. Click “Run”. 'A screenshot of showing the screen of running python installer.'

Step 4. IMPORTANT!

Add Python to the PATH

IMPORTANT! If you are on a Windows system - make sure that the last checkbox is marked! 'A screenshot of showing the checked box to add Python to PATH.'

This will help your computer know where the Python interpreter is located. You won’t fail if this is not marked, but it can bring some small difficulties to you next. (If you want to know more about that - look up “Environment Variable PATH”.)

If later you will have some failures in installation (unlikely) you can restart the installation without any checkmark here.

Save the Python path

Copy or Print Screen or manually write down the line below the “Install now” line. It will tell you where your Python Interpreter stored. You will need it if you want to run Python on the Python Interpreter (something that we are not going to do in this course).

'A screenshot of the Python PATH.'

Step 5. Install

Press the “Install Now” line. 'A screenshot of the setup progress.'

Wait until the installation process is finished.

Step 6. Celebrate or Troubleshoot

See the “Installation was Successful” line. If you have not seen it, or you saw “Installation Failed” - that means your Python Interpreter is not installed! Return to the previous steps. 'A screenshot of the successful setup screen.'

Congratulations! You’ve successfully done the installation. Now we learn how to check that the Python interpreter works.


How to use IDLE with files?

Open IDLE on your computer. If you have installed Python - IDLE goes with it in one package.

'A screenshot of the menu showing IDLE.'

Warning!

⚠️ IMPORTANT: When IDLE opens, it opens what is called a Python Console - you’ll see “IDLE Shell” or “Python Shell” when you look at the very top of that window.

  • If you are seeing Type "help", "copyright", "credits" or "license()" for more information. in this window, then you are in the IDLE Python Shell.
  • DO NOT use the IDLE/Python Shell to write the code for this class.

Instead, create a new file, so that your code will be saved on your computer and can be re-run.

Create a new Python file in IDLE

'A screenshot of the menu showing how to create a new file using New File submenu.'

Use “File” -> “New File” to create a new file or “File” -> “Open” to open one that you previously created.

Remember to save your work somewhere you can find it. (We recommend creating a dedicated folder for your code.)

When you are in the file-editing window, you can use “Run” -> “Run Module” to run this specific file as a script and see your code in action. 'A screenshot of the menu showing how to run a file using Run Module submenu.'

⚠️ If you are not seeing the top menu "Run", then you are not in the file-editing window.

Running a file that asks for user input

Note! If your program requires input you will need to provide it inside the Python console, which will be displaying the output of your program/script!

Python will put the cursor and wait until you give the input to it. It won’t run your program or give you any hints that it is waiting for something. Be careful with inputs!


Helpful notes

Enable line numbers

In IDLE, you can select the "Show Line Numbers" option from the top "Options" menu. Seeing line numbers helps a lot with debugging, since Python errors report the code’s line number where the error was detected.

Force the program to stop

If you want to stop the program that behaves unexpectedly or runs for too long - just press Ctrl+C (Control and C at the same time) and the program will stop with the “Keyboard stopped me” Error (KeyboardInterrupt).

Function prompts

If, in IDLE file mode, you write the name of a function, type an open parenthesis ( and wait a little, you will get a help prompt that shows you how to use this function. 'A screenshot of the IDLE file that shows a help prompt.'


We hope that this is helpful 👍. If you have any follow-up questions 🧐 or comments, we look forward to addressing them on the forum.

Have a productive week!


Acknowledgements

Specials thanks to Liubov Kurafeeva and Roman Beltiukov for creating the initial instructions and screenshots.

General instructions were adopted from https://python-adv-web-apps.readthedocs.io/en/latest/.