You’ll need a few mandatory prerequisites for successfully participating in the course.
> means prompt, don’t type that in)
> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Y for Yes.
Keep this window open for the following steps to create a virtual environment!
To make sure you have all the prerequisites properly installed:
Using the same PowerShell window from earlier, type:
> py -3.7
This should open a REPL window with a prompt.
Ctrl + Z followed by Enter to exit this screen and go back to your prompt.
Type the following on your terminal.
$ python3 --version
You should see
If you don’t see a Python version greater than 3.7, please follow the instructions for installing Python3 again.
A Virtual Environment in Python is a self-contained directory that contains a Python installation for a particular version of the language.
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.7 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 -m venv env > env\scripts\activate
Your prompt should now look like this, but with your own username.
(env) PS C:\Users\nina\pyworkshop>
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.
Open a terminal window. Type the following.
(Do not type the
$ character, that signifies a prompt.)
$ cd $ mkdir pyworkshop $ cd pyworkshop $ python3.7 -m venv env $ source env/bin/activate
source env/bin/activate is how you activate your virtual environment on Mac or Linux. You’ll want to do that each time you enter this Python project directory from a new shell.
Your prompt will look like this to indicate that the virtual environment is active.
You are expected to work from this project folder for the duration of the class, with an activated virtual environment.
Look for VS Code in your Applications, or type the following in your Mac/Linux or Powershell terminal.
$ code --version
You should see something like:
1.32.3 a3db5be9b5c6ba46bb7555ec5d60178ecc2eaae4 x64
If you don’t see VS Code, please follow the instructions for installing VS Code again.
Note that after the course you can use the IDE of your choice to continue on your Python adventure.