Table of contents
- General Instructions to Install Python
- How to install the Python Interpreter on a Windows machine?
- How to use IDLE with files?
- Helpful notes
General Instructions to Install Python
- Go to https://www.python.org/
- Roll over the Downloads link on the top blue bar. You should get a button to download the version for your operating system.
- Be sure to choose the latest Python version that starts with
3.
- 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.
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â.
Step 4. IMPORTANT!
Add Python to the PATH
IMPORTANT! If you are on a Windows system - make sure that the last checkbox is marked!
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).
Step 5. Install
Press the âInstall Nowâ line.
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.
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.
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
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.
â ď¸ 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.
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/.