Installing Python and PyCharm


Running into issues? Check out the PyCharm Bugs handout, post on Ed, or come chat with course staff in person!

In CS106A, you will be editing and running your code using an application called PyCharm. PyCharm is what is known as an IDE, or Integrated Development Environment, which means that it allows us to edit our code, browse our files, run our programs and debug them, all in the same place. This handout will walk you through installing 1) the language Python and 2) the IDE PyCharm on your own computer.

1. Installing Python

In order to be able to run Python programs on your computer, you need to install a Python Interpreter. An interpreter is a program that is capable of reading a .py file that you have written, and translating the Python code in that file to instructions that your computer can easily execute. Begin by downloading Python. Select the link corresponding to your operating system and download the latest stable version of Python 3 (not a preview release):

macOS Downloads


After clicking the link above:

  1. Click on the top link on that page, labeled "Latest Python 3 Release" (not the Python install manager).
  2. On the following page, scroll to the bottom, where you'll see a table under "Files."
  3. Click on the link for the version of Python that describes your operating system (the macOS installer).
  4. (See note below!) Click on the downloaded package and follow the install instructions.

Windows Downloads (If you're using a relatively new Windows computer, use this link)

After clicking the link above:

  1. Click on the top link on that page, labeled "Latest Python 3 Release" (not the Python install manager).
  2. On the following page, scroll to the bottom, where you'll see a table under "Files."
  3. Click on the link for the version of Python that describes your computer: "Windows installer (64-bit)" for most computers, or "Windows installer (ARM64)" for an ARM computer.
  4. Click on the downloaded package and follow the install instructions.

Note:

Some Macs already have Python installed, but it may be an older version of Python. CS106A requires the use of the newest version of Python, so even if you think you already have Python installed, please follow the steps above.

Note:

When you open the downloaded file, before installing, there should be an option that says "Add python.exe to PATH." Make sure to check this box. Then, continue installing normally.


2. Installing PyCharm

To get started, download and install PyCharm. The core features we use in CS106A are free, and you do not need a paid subscription or Pro trial for this course.

Mac Download Page

  1. Note that newer Mac computers have an Apple Silicon chip, whereas older Macs have Intel chips. To check which you have, go to the Apple symbol in the upper-left corner of your computer, click "About This Mac," and see whether your chip is Apple or Intel.
  2. On the PyCharm download page, select the macOS tab and choose the .dmg download for Apple Silicon or Intel based on what you saw above.
  3. Open the downloaded .dmg file and drag PyCharm into your Applications folder.

The current PyCharm release requires macOS 15 or newer. If your Mac has an older version of macOS, check the system requirements and download a compatible version from JetBrains' previous releases. Course staff can help you choose a version if you are unsure.

Windows Download Page

  1. Select the Windows tab on the download page.
  2. Choose the .exe download for Windows. Most computers use the standard Windows download; choose Windows ARM64 if your computer has an ARM processor.
  3. Open the downloaded .exe file and install PyCharm using the default options.

At the end of the PyCharm installation process, open PyCharm, and you'll see a welcome screen:

The screenshots show a Mac. The same steps apply on Windows, although your menus, file paths, and Python version may look slightly different. Click a screenshot to see it at full size.

To open Settings and reach the Python Interpreter configuration, click the gear icon in the top-right corner of the PyCharm screen, then select "Settings…" from the menu.

In Settings, click "Python" on the left and then "Interpreter." If Settings opens to a different page, use the search box to find "Python Interpreter." You should see a screen like this:

If the interpreter is already set to the version of Python you just installed, click "OK" and continue to Part 3. Otherwise, open the interpreter dropdown and select "Show All…":

Click the + button in the upper-left corner to add an interpreter.

Choose "Select existing", set the type to "Python", and select the Python version you just installed from the "Python path" dropdown. If it is not listed, use the folder button to find the Python executable. The screenshot shows Python 3.14; your version or path may differ.

Click "OK" to add the interpreter, then "OK" again to return to Settings. You should now see your selected interpreter:

Click "OK" to return to the welcome page. You're now ready to test PyCharm! Part 3 is a good sanity check and resembles the way you'll download and open a project for HW2.


3. Testing PyCharm

When you work on assignments in CS106A, we'll have you download a PyCharm project, which is a folder containing Python code files (.py files) and sometimes other files your program will need, like images or text files. You'll open up the entire project folder using PyCharm, then edit the files in PyCharm.

To gain familiarity with the PyCharm environment, first try this small sample project. This is just a setup check; you do not need to submit it.

  1. Download the sample project linked above.
  2. In your Downloads folder, right-click the downloaded zip file and select "Extract All…" double-click the downloaded zip file to unzip it.
  3. Go back to the PyCharm welcome screen and click "Open…" on the left.
  4. In the file navigator, go to Downloads and select the unzipped pycharm_intro folder. Whenever you open projects in PyCharm, open the folder containing the files you want to edit, rather than just the files themselves. Windows sometimes creates another nested folder when extracting a zip. Select the innermost folder containing intro.py.
  5. Click "Open."

Nice, you've just opened a project in PyCharm! You should see intro.py in the Project panel on the left:

Double-click intro.py to open it in the file editor. Here, you can view and edit code. You aren't required to read or understand this sample code yet, but this editor is where you'll write your code this quarter.

If you see the banner "No Python interpreter configured for pycharm_intro," click "Custom Environment" on the right and select "Add Local Interpreter…":

Choose "Select existing", set the type to "Python", select the Python version you installed, and click "OK", as shown in Part 2.

Now, click the Terminal icon (>_) on the left sidebar near the bottom. This will open a terminal panel:

In PyCharm, we use the terminal to run our programs (unlike in the Experimental Server, where we can just hit the "Run" button). To run a program, we type something into the terminal and hit Enter. First, let's test that you installed Python correctly. Type this into the terminal, not the file editor:

python3 --version

After pressing Enter, you should see the Python version you installed, such as Python 3.14.x. If the command isn't found or shows a different version, restart PyCharm after installing Python and check your interpreter settings.

Next, run the sample program:

python3 intro.py

You should see a greeting like this:

Nearly there! Sometimes we'll give more information after the program's filename, like a name or the "mode" we want to run the program in. Try this command, replacing "Iddah" with your name:

python3 intro.py Iddah

Congratulations! You've tested your PyCharm setup. If you ran into any bugs along the way, check out the PyCharm Bugs handout, post on Ed, or come chat with course staff.

Getting ready for HW2

Now download the Image Grid project from the HW2B handout, unzip it, and open the image-grid folder in PyCharm using the same steps above. Double-click image-grid.py to open it in the file editor. You'll write code to replace the pass statements and complete HW2B; for now, leave these functions empty.

In the Image Grid project's terminal, install the "Pillow" library, which you need for the image-processing code you're going to write. Type this and hit Enter:

python3 -m pip install Pillow

This will take a couple of seconds. If everything worked correctly, you'll see "Successfully installed Pillow" near the end of the output. If you already had Pillow installed, "Requirement already satisfied" is also a sign of success.

Finally, enter the following into your terminal (you can replace "Alice" with your name) to make image-grid.py say hello to you:

python3 image-grid.py -hello Alice

You're now ready to start working on the assignment in the file editor. See the HW2B handout for next steps.


4. Disable AI Code Completion

Disable PyCharm Autocomplete. CS106A is about learning to read and write code yourself. Using AI code completion undermines that goal. PyCharm's built-in AI also hasn't seen the assignment, so its suggestions are often incorrect and can introduce code that doesn't exist in the starter files.

Before starting the homework, open PyCharm Settings and go to Editor → General → Code Completion:

  • Popup: Uncheck "Show suggestions as you type."
  • Inline: Uncheck "Enable inline completion using language models."

In the Terminal panel, open the three-dot menu and uncheck "Show AI Agents" if that option is present.

You can keep using PyCharm's free core features if a Pro trial starts automatically or expires. You do not need to purchase a subscription for CS106A.