Installation Guide
The following is a short installation guide for this course. We'll generally be assuming access to a Unix-style command line.
Note: In the long run, if you're a Windows user, I recommend setting up a WSL environment. This gives you a Linux subsystem that'll make other CS courses go a lot smoother (in my opinion). If you don't do this (e.g., if you want to work directly in PowerShell), then we cannot guarantee we'll be able to troubleshoot issues you might run into.
Setting Things Up
Install the latest release of Python from https://www.python.org. Follow the "Downloads" tab to an installer for your operating system. After doing this, you should open up a terminal and run the command
python3
on the command line to open an interactive Python REPL (Read-Eval-Print-Loop) to verify that everything was set up correctly. You can then type Ctrl-D to exit the REPL.
The above installation includes a program called
pip3, which is a package manager for Python. Run the following command:pip3 install sympy numpy scipy matplotlib networkx scikit-learn
This will install all the libraries you need for this course.
- (Optional) Install VS Code.
Working on Python Code
- Open up a
file_name.pyfile in your favorite editor and edit the code. In a terminal, navigate to the directory where your Python file is, e.g.,
cd path/to/directory/where/file/is
Run the command
python3 file_name.py
to evaluate the code in that file. If you want to evaluate the file and then go into an interactive Python REPL, then run
python3 -i file_name.py
Tips
You may want to brush up on basic command-line usage. Important things to know:
lsshows what's in your current directorypwdshows the path of the directory you're currently incd path/to/directory_namegoes to the directory given by the pathrm filedeletes the file (this cannot be undone! it's not the same as putting it in the Trash folder)rm -r directory_namedeletes a directory and everything in it (this cannot be undone!)touch file_namecreates an empty file calledfile_namemkdir dir_namecreates an empty directory calleddir_name
(Become comfortable with these commands!)
I generally recommend putting all your code for this course in a single directory in, for example, your Documents folder. You can run the command
mkdir -p ~/Documents/cs132-f26
to create this directory. This is equivalent to going to the Documents folder (in Finder for macOS) and creating a new folder.
- Setting up a machine takes some time (and some tears). But please understand that this is an incredibly important part of being a computer scientist. You have to know how to set up your coding environment.