Prerequisites¶
Before you can begin, your computer needs the following tools installed and working to participate.
A command-line interface to interact with your computer
A text editor to work with plain text files
Version 3 of the Python programming language.
The pip package manager for Python
Depending on your experience and operating system, you might already be ready to go with everything above. If so, move on to the next chapter. If not, don’t worry. And don’t give up! It will be a bit of a slog but the instructions below will point you in the right direction.
Note
One potential shortcut is using GitHub codespaces instead of setting up your own computer. It’s free and will let you use the command line and run Python without having to download a thing.
Command-line interface¶
Unless something is wrong with your computer, there should be a way to open a window that lets you type in commands. Different operating systems give this tool slightly different names, but they all have some form of it, and there are alternative programs you can install as well.
On Windows you can find the command-line interface by opening the “command prompt.” Here are instructions for Windows 8 and earlier versions. On Apple computers, you open the “Terminal” application. Ubuntu Linux comes with a program of the same name.
Text editor¶
A program like Microsoft Word, which can do all sorts of text formatting like change the size and color of words, is not what you need. Do not try to use it for this class.
You need a program that works with simple “plain text” files, and is therefore capable of editing documents containing Python code, HTML markup and other languages without dressing them up by adding anything extra. Such programs are easy to find and some of the best ones are free.
If you don’t have one already, try installing Microsoft’s Visual Code Studio, a popular, free option.
Python¶
If you are using Mac OS or a common flavor of Linux, Python is probably already installed. Tou can test to see what version, if any, is there waiting for you by typing the following into your terminal.
python --version
If you don’t have Python installed, you’ll see an error. This is a more likely fate for Windows users, who try downloading and installing Python 3.10 from here.
In Windows, it’s also crucial to make sure that the Python program is
available on your system’s PATH
so it can be called from anywhere on
the command line. This
screencast
can guide you through that process.
While Python 3.10 is preferred for this class, but you can probably find a way to make most of this tutorial work with other versions.
pip¶
The pip package manager makes it easy to install open-source libraries that expand what you’re able to do with Python. Later, we will use it to install everything needed to create a working web scraper.
Verify pip is installed with the following.
pip --version
If you don’t have it already, you can get pip by following these
instructions.
In Windows, it’s necessary to make sure that the Python Scripts
directory is available on your system’s PATH
so it can be called
from anywhere on the command line. This screencast
can help.