Lesson 2
15 min
Download Python, install it on your system and set up VS Code.
Definition
Installing Python means placing on your computer theinterpreter (the program that reads and runs your code), the standard library (ready-to-use modules) and the pip tool (the package manager). Once the installation is complete, thepythoncommand becomes available in any terminal, thanks to thePATH system variable, which tells your computer where to find it.
Python can be downloaded for free from the official website,python.org, in the “Downloads” section. The site automatically detects your operating system and offers you the latest stable version of Python 3.
Always download Python from this official site and avoid third-party sites that offer “installers”: they may contain unwanted programs. Choose the most recent stable version, unless your school or your project requires a specific version. On a recent computer, the 64-bit version is the one you need.

Run the downloaded.exefile. On the very first screen of the installer,be sure to check the “Add python.exe to PATH” box before clicking “Install Now”. This option lets you use Python from any terminal.
The installation takes one to two minutes. When it finishes, the installer displays “Setup was successful”: you can then close the window. If Windows asks for permission to make changes to your computer, accept.

.pkgfile from python.org and follow the installation wizard. Just click “Continue” until the end.sudo apt install python3on Ubuntu or Debian).On Linux, it can also be useful to installpython3-pipto get pip, the package manager you will need later to add libraries.
Open a terminal (or VS Code’s built-in terminal) and type the following command:
python --versionYou should see a version number, for examplePython 3.12.4. On macOS and Linux, the command is often calledpython3:
python3 --versionOn Windows, ifpythondoesn’t respond, try the official launcherpy:
py --versionpip is installed at the same time as Python. It is used to download libraries written by other developers. Check that it’s there with the following command:
pip --versionOn macOS and Linux, the command may be calledpip3instead. You will see later how to install a package withpip install package_name. For now, it’s enough to know that the command exists.
By simply typingpythonin the terminal, you open interactive mode: a space where you can write an instruction and immediately see its result. It’s ideal for quickly testing an idea.
>>> 2 + 3
5
>>> print("Python is installed!")
Python is installed!
>>> exit()The>>>symbols indicate that Python is waiting for an instruction. To quit, typeexit()or use the shortcutCtrl + Zthen Enter on Windows,Ctrl + Don macOS and Linux.
If you use VS Code, install Microsoft’s official Pythonextension from the Extensions tab. It adds advanced syntax highlighting, auto-completion and a button to run your files with one click.
Once the extension is installed, open the command palette withCtrl + Shift + P, type “Python: Select Interpreter” and choose the version of Python you just installed. That way, VS Code will know which interpreter to use to run your programs.
Python 2.7, usepython3instead.Good to know
If the terminal answers “python is not recognized”, it’s almost always because the “Add to PATH” box wasn’t checked. Run the installer again, choose “Modify”, then check the corresponding option.
Exercise
python --version(orpython3 --version) does display a 3.x version. Then check thatpip --versionresponds too, then try interactive mode by calculating an addition. Finally, install the Python extension in VS Code and select your interpreter.