Head’s up We are using Python 3.11 for this course. If any installation instructions show an earlier version, replace with 3.11. Later versions are fine as long as they start with 3.11. E.g. 3.11.1 etc.
sudo apt install python3.11-dev python3.11-venv
Enter these commands in your terminal from a convenient location. E.g. in your home directory.
mkdir python-fun
cd python-fun
python3.11 -m venv .venv
source .venv/bin/activate
python --version
deactivate
You can delete python-fun
folder now if you like.
Let’s do our best to avoid typing in commands we don’t understand. Here’s what each command is doing:
mkdir python-fun
is creating a new directory.cd python-fun
changes your working directory to your project folder.python3.11 -m venv .venv
uses the correct version of Python to create a virtual environment
for your code.
virtual environment
can be thought of as a sandbox where you can safely manage your project without conflicting with any other Python installations used by the Operating System.virtual environment
is created in the .venv
folder because .venv
was the last argument supplied to the command..venv
, but that is a common convention and what we will use in class.source .venv/bin/activate
will activate
the virtual environment so that its version of Python becomes the current one in use.
(.venv)
at beginnng of prompt.python --version
shows the currently used Python version.
python3.11
command because we are running inside a virtual environment
so it can safely know what version of Python is being used.Python 3.11
deactivate
will “turn off” the virtual environment. It’s still there in the .venv
folder, but won’t be active until you reactivate it with source .venv/bin/activate
.venv
folder you can recreate it with python3.11 -m venv .venv
PyCharm is the editor of choice for professional Python developers.
Heads up! If you are a Windows user using WSL please follow the Windows link.
NOTE: Installing Docker tends to be really easy or really hard. So give it a shot and find out. If it gets hard then stop and let Code Fellows know about installation issues when class begins. Docker won’t be used until second half of class so there’s time to get things set up right.