Windows Setup

For this course, you’ll be using the latest stable version of Python available which is currently Python 3.9.

You’ll be using VS Code throughout the class to provide a consistent experience for all students. Once the course is over, feel free to go back to the editor of your choice to continue on your Python adventure.

If you’re used to keybindings in a different editor, you can set up a keymaps extension in VS Code to match what you’re used to.

Downloads

Install Python3 from the Python.org

Download Visual Studio Code Python Extension for Visual Studio Code

Making sure you’re ready

To make sure you have all the prerequisites properly installed:

Install Python 3

Download and run the above installer. Be sure to select “Add Python 3.9 to PATH” on the first screen, and select Install Now.

On the last page of the Python 3 installer, select “Disable Path Limit” before hitting close.

Close the installer.

From the Windows menu, search for PowerShell and right-click to Run as Administrator.

In the PowerShell window, type:

> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

Enter Y for Yes.

Check for Python 3.9

In your open PowerShell window, type:

> py -3.9

This should open a REPL window with a prompt.

Type exit() followed by Enter to exit this screen and go back to your prompt, or use the keyboard shortcut Ctrl+Z and press Enter.

Creating a Virtual Environment and The Project Folder

A Virtual Environments in Python is a self-contained directory that contains a Python installation for a particular version of Python.

It’s a very useful way to make sure that we’re using the right Python version when we’re working on a particular project.

Let’s create a project directory and a Python 3.9 Virtual Environment.

Using the same PowerShell terminal from earlier, type the following commands in one by one:

> cd $home
> mkdir pyworkshop
> cd pyworkshop
> py -3.9 -m venv env
> .\env\Scripts\Activate

Your prompt should now look like this, but with your own username.

(env) PS C:\Users\nina\pyworkshop>

Upgrade pip

Next, upgrade pip, the Python package installer to the latest version.

python -m pip install --upgrade pip

env\Scripts\Activate is how you activate your virtual environment in Windows. You’ll want to do that each time you enter this Python project directory from a new shell.

Troubleshooting

You are expected to work from this project folder for the duration of the class, with an activated virtual environment.

If something is not working, please make sure that you’re in the correct project directory with an activated virtual environment.

Checking VS Code

Look for VS Code in your Applications, or type the following in your terminal.

> code --version

You should see something like:

1.49.0
e790b931385d72cf5669fcefc51cdf65990efa5d
x64

If you don’t see VS Code, please follow the instructions for installing VS Code again.