Where is everything? What do I need before each class? What sort of computing setup do I need?
Answers in a handy checklist form!
✓ Starting Each Class 👩🏻🏫
Open your laptop, prepare to get hands-on! Details:
Open the Class Schedule Table, so you will have access to today's materials (LINK ↗)
Open the MS Teams course forum, get ready for chat (LINK →)
Start your Python application. You should have two windows: a script editor, and an interactive shell/console/terminal.
Open your designated script folder on your laptop where you save your Python scripts.
✓ Make a Designated Folder for your Work 📁
On your laptop, create a folder where you will keep your Python scripts for this class. Suggestion: "ling1330" under your "Documents" folder. Make note of this folder's full path.
Windows people: it will be something like C:\Users\your-user-name\Documents\ling1330. It may have OneDrive before Documents.
Mac people: it will be something like /Users/your-user-name/Documents/ling1330.
✓ Setting up your Python Working Environment 🐍
There are many modes of programming with python, many apps/IDEs, and many Python distrbutions. In this class, we will utilize the following setup:
Distribution: Anaconda Python (current python version 3.14; slightly older versions 3.13/3.12 are fine too.)
Apps: Terminal (on Windows/Mac) and Spyder (included in Anaconda)
What if you're using a different app (ex. VSCode) or distribution (ex. python.org distro)? This is fine as long as you can produce the two types of python deliverables noted above and generally know your way around system management (conda and pip, venv, etc.). If you're unsure, you should follow the recommended setup -- instructions below.
Download the graphical installer file for "Anaconda Distribution". Note: Chrome may quietly block downloading this file; if this happens, try a different browser like Edge (Windows) or Safari (Mac OS).
Then, install. Choose "Install for All Users" option if you can. Otherwise, "Just Me" is fine.
Note that Anaconda Python comes bundled with many popular 3rd party software libraries. It takes a while to finish installing, and it will take up a lot of space on your disk storage (5+GB).
Running Python Interpreter Shell in Terminal (Windows)
Open your START menu, change "View: Category" button to "List", which shows all apps. Expand the "Anaconda (anaconda3)" folder entry, find the shortcut to "Anaconda Prompt" and run it. (see screenshot)
At the command prompt, type python followed by the ENTER key. Try some python commands, and then exit() to get out. (screenshot)
You can also run a Python script in an interpreter shell. In Anaconda Prompt, run python -i hello.py (You might have to move into your script folder first, e.g., cd Documents/ling1330) (see screenshot)
Running Python Interpreter Shell in Terminal (Mac OS)
In Finder, open "Applications" and then "Utilities" folder. Run Terminal.app (see sceenshot).
At the command prompt, type python followed by the ENTER key. Try some python commands, and then exit() to get out. (screenshot)
You can also run a Python script in an interpreter shell. In Anaconda Prompt, run python -i hello.py (You might have to move into your script folder first, e.g., cd Documents/ling1330) (see screenshot)
NLTK setup
Install NLTK
Anaconda users: nltk is already on your system, so no need to install. Skip to the the next step to download the data pack only.
Students using the python.org distribution should install NLTK through pip. If you have trouble importing nltk after installation, see this FAQ. This usually happens when you have multiple Python distributions on your machine.
Download NLTK data
Next, you should download its data pack. In a Python shell, run import nltk followed by nltk.download('all'). It should go like this.
Try and see if the Brown corpus loads successfully: nltk.corpus.brown.words(). See the screenshot.
Confirm your NLTK is all set: restart Python, then run import nltk followed by nltk.corpus.brown.words(). See screenshot.
Launching Spyder (Windows)
Open your START menu, hit the "All apps" button and find the "Anaconda (anaconda3)" folder entry. A shortcut to Spyder will be inside (see screenshot). The first launch will take a long time, so be patient.
You can also pin Spyder on your START menu, or launch it by typing out the name.
Ultimately, your Python work environment should look like this: (Windows)
Launching Spyder (Mac OS)
Option 1, SLOW: "Anaconda Navigator" app, once opened (will take a while), displays a shortcut to Spyder. You can launch Spyder this way, but it's cumbersome.
Option 2, FAST: On your Terminal, type spyder & and ENTER. Spyder will launch (the very first launch will take a while, so give it some time). This is the recommended way to run Spyder.
Ultimately, your Python work environment should look like this: (Mac)
✓ Other Configurations and How-To's 💻
Showing extensions (Windows)
Windows OS hides away file extensions in the file name, so you end up seeing my-notes when the true file name is my-notes.txt or my-notes.docx! To fix this, open any folder, click "View", then "Show" at the bottom, and check "File name extensions". See this screenshot.
Unactivating base virtual environment in Terminal (Mac OS, ADVANCED)
Advanced users only! After installing Anaconda Python, you will notice your Terminal window permanently displaying (base) in the prompt. This means Anaconda's "base" virtual environment (venv) is activated by default in your Terminal. If you'd rather use the "base" venv only when you need it, follow the instructions below.
Turn off conda's auto activation of base. In Termnal, run: conda config --set auto_activate_base false
Launch a new Terminal window. (base) will now be gone from your prompt.
From this point on, you have to manually turn on and off the "base" venv, according to your needs. To turn on, run conda activate base in Terminal. And run conda deactivate to turn off.