Installing Python
Please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.mit.edu) to authenticate, and then you will be redirected back to this page.
1) Overview
This page guides you through setting up your computer to edit and run Python code. The overall procedure is as follows:
- Install the base Python interpreter.
- Install the Visual Studio Code (VS Code) editor.
- Install the Python extension for VS Code.
- Finalize some settings.
Note: You do not need to install any third-party Python packages at this point. We will let you know and demonstrate as needed throughout the course.
Before starting, make sure your operating system is up-to-date.
If you are unsure about any of the instructions below, or run into issues, please come to office hours, and a TA or LA will help you. You may also post on Piazza (see link on the Overview page), though more complex issues may be easier to figure out in person.
2) Install the Python interpreter
There are official install instructions for Windows and macOS. They are quite long, however, so here is our summary of the steps.
-
Download the Python installer by clicking the yellow download button on this page: https://www.python.org/downloads/.
-
Find where the installer got downloaded, and double-click it to run. Click through any security warnings. We recommend accepting all the default options, i.e., avoid selecting any additional checkboxes or customizations.
- Windows: At the end, the installer may ask you to Disable path length limit. If it does, we recommend you do so.
-
macOS: The official instructions also ask you to run the Install Certificates.command file at the end of installation. Go ahead and do that.
3) Install VS Code
The official install instructions are contained within a section on these pages: for Windows and for macOS. They're fairly straightforward, so go ahead and follow them.
The top of these pages also directs you to install additional components and features. You're free to try them later, but we suggest avoiding them for now.
When finished, go ahead and launch VS Code. Recommendations/notifications may pop up in the bottom right periodically; we also suggest ignoring them for now.
4) Install the Python extension
To run Python code within VS Code, you will need the VS Code Python extension. Follow these steps to install the extension and confirm you can run Python.
-
Click the Install button on the extension's official page. It should open in VS Code a new tab for the extension. Click Install again there.
- During the process, a few other related extensions will be installed as well.
-
Download and save our
test_installation.py
file to a folder. -
Open the EXPLORER pane by clicking its icon near the top left. Click Open Folder, and select the folder where you downloaded
test_installation.py
. You should see the file in the pane; double-click it to open it in a tab.- If a security warning about trust pops up, click Yes, I trust the authors.
-
At the very bottom right of the VS Code window, you may see a highlighted segment that says Select Interpreter. If so, click it, and a drop-down from the top center should list available Python interpreters on your computer. Select the one you installed in the section above, and the segment should now display the Python version number.
-
Press
Esc
to close the drop-down, and click the play button in the top right. (When you hover over the button, it says Run Python File.) This should open a TERMINAL pane with output like the following:############################################################ This is the output of the installation test file for 6.100. You are running: Python 3.13.7 on Windows 11 in directory C:\Users\bob\Downloads\test-6100-python ############################################################
macOS users should see
Darwin
instead ofWindows
in the output. -
It's good practice to close terminals when no longer needed. At the top-right of the TERMINAL pane, click the trash button to close it. (When you hover over the button, it says Kill Terminal.)
5) Finalize settings
These are some VS Code settings to make sure you can properly run code in our course and to help reduce extraneous spacing in your files.
-
Open your VS Code Settings, and stay in the User category as opposed to Workspace.
- Windows: From the top menu bar, go to Files → Preferences → Settings.
- macOS: From the menu bar, go to Code → Settings... (or Preferences on older Macs) → Settings.
-
Find and enable the setting Python > Terminal: Execute in File Dir.
Do not skip this step! -
Find and enable the following settings:
- Files: Insert Final Newline
- Files: Trim Final Newlines
- Files: Trim Trailing Whitespace
-
Close the Settings tab when done.