← All stepsBobgame: make a Python game

Step 3 of 12

Make the project folder and a virtual environment

Make a folder called bobgame somewhere easy to find, then in VS Code choose File > Open Folder and open it. Open the built-in terminal with Ctrl+` (that's the key above Tab).

Now create a virtual environment. Think of it as a private toolbox just for this game, so the things we install for Bobgame don't get mixed up with other projects.

py -3 -m venv .venv

This makes a hidden folder called .venv. VS Code will usually pop up a message asking if you want to use it, click Yes. If it doesn't, press Ctrl+Shift+P, type Python: Select Interpreter, and pick the one that has .venv in its path.

On Ubuntu this is python3 -m venv .venv.

Docs: venv - Creation of virtual environments