The terminal is a text-based way to talk to your computer. You'll need it for exactly two things in this course: installing libraries (pip install ...), and occasionally running a Python script (python myscript.py). Five commands, and you're set.
pwd (Mac) / cd on its own (Windows) — "where am I?"pwd
# /Users/yourname
Tells you which folder the terminal is currently looking at.
ls (Mac) / dir (Windows) — "what's in this folder?"ls
# Documents Desktop Downloads Music ...
cd folder_name — "move into this folder"cd Desktop # move into Desktop
cd .. # move one folder up
cd ~ # go to your home folder (Mac/Linux)
mkdir new_folder_name — "make a new folder"mkdir python-projects
cd python-projects
pip install <library> — install a Python librarypip install openpyxl
You'll see a stream of text as pip downloads and installs the library. When the prompt comes back, it's done.
python myscript.py — run a scriptpython hello.py
# Hello from VS Code!
# Line 1
# Line 2
# ...
pip install xlsxwriter
Press Enter. Watch the lines scroll. When you see Successfully installed xlsxwriter-..., you're done.
Open a Jupyter notebook or a Python file and run:
import xlsxwriter
print(xlsxwriter.__version__)
You should see a version number, not a red error.
pip isn't recognised, try pip3 instead, or open Anaconda Navigator → Environments → click the green ▶ next to base (root) → "Open Terminal", then run pip install ... from that terminal.
pwd, ls/dir, cd, mkdir, pip install.pip install is how you add any extra library.python-for-excel.cd into it.pip install xlsxwriter requests beautifulsoup4.