My WebP imageCMSC388J
Python

Getting Started with Python

Python Installation and Setup

Version

We will be using Python 3.12 to grade projects. You are free to use other versions but not using Python 3.12 could lead to inconsistencies between local and autograder outputs.

Installation

Follow installation instructions based on your operating system:

Once installed, you should be able to access python3 and pip3 from your terminal.

Run python3 --version to verify your installation was successful.

Development Environment

The instructors use VS Code, and so it is recommended for students to use VS Code. Using the same IDE will make debugging projects more simple. You may also choose to use:

  • PyCharm
  • Vim/NeoVim
  • Emacs

...or really any IDE or text editor built for Python or general use.

Virtual Environments

Different libraries may require conflicting versions of dependencies. To solve this, Python developers use virtual environments to "localize" which versions of Python and other dependencies a project should use. A requirements.txt file is usually provided to list all of a project's dependencies. For each project, you should create a virtual environment based on the provided requirements.txt.

For this class, we will be creating environments using venv, but you are free to use other options.

Run these commands to setup a virtual environment:

python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt

Run this command to save your virtual environment:

pip3 freeze > requirements.txt