Module 1 · Technical track (optional): machine learning fundamentals

Python environment: install without messing up your computer

Lesson 1 of 15 8 min lesson Updated on October 30, 2026
Progress in the course7%

In this lesson

A tidy environment prevents errors.

Almost every installation error in AI has the same cause: the computer is using a different program from the one you think it is. Here you install Python the right way and create a drawer for each project. You do not need to know how to program.

Which Python is answering

When you type python in the terminal, the computer looks for that program in a list of folders. It works like the contact list on your phone: it takes the first one it finds with that name. If two Pythons are installed, the error comes from the computer picking the one you did not want.

import sys
print(sys.executable)
print(sys.prefix)
print(sys.base_prefix)

This script shows which program is answering. If the last two lines are the same, you are not in a separate environment. Run it whenever something does not work.

Which version to use

Python releases a new version every year, and each one gets fixes for a while. Version 3.10 stopped being updated on October 1, 2026, so do not use it. In October 2026, the safe choice is 3.14. The very latest version can cause trouble, because the libraries need to publish a ready-made package for it.

SystemHow to installCareful
Windowspython.org; use the py commandIf the store opens, turn on the Python aliases
Macpython.org; use python3Do not touch Apple's Python
LinuxWhatever the distribution shipsInstall only inside a virtual environment

Virtual environment: one drawer per project

Think of one toolbox per building job. House A uses one version of a drill, house B uses another, and one box does not touch the other. The virtual environment is that box: a folder with the libraries of one project.

python -m venv .venv
.venv\Scripts\activate        (on Windows)
source .venv/bin/activate     (on Linux and Mac)

Activating only puts the environment's folder at the front of the list of programs. Nothing more. And keep the list, not the folder: the environment is disposable. If you change machines, delete it and recreate it from requirements.txt.

Always use python -m pip instead of pip on its own. That way the package goes to the Python you are using, and not to another one hidden on the computer.

What the pros know

You do not even need to activate the environment. The Python documentation explains that it is enough to call the environment's Python by its full path, such as .venv/bin/python, and that the programs installed in it also run without activation. This helps with automatic tasks, such as a scheduler that runs in the middle of the night: instead of depending on a terminal where someone activated the environment, you point straight at the project's Python.

The graphics card in three layers

The card does many calculations at the same time, and AI likes that. But there are three layers, and each one can fail. The card is the engine. The driver is the translator the system installs to talk to the engine. The program is the request your code makes.

A very old driver makes the program say it did not find the card. Updating the driver usually does not break anything. On a Mac with an Apple chip there is no NVIDIA CUDA, and PyTorch uses another path, called MPS.

Careful

Do not use sudo pip install or --break-system-packages. Both touch the system's Python and can break tools on the computer. The way out is always a virtual environment.

Jupyter: the notebook and the engine

Jupyter is a notebook in the browser where you run the code block by block. The one doing the calculations is the kernel, a separate program behind it. Closing the tab does not stop the kernel. To reset everything, use the Kernel menu and choose Restart. And remember: the kernel is one specific Python. If the notebook uses another environment, it will not find the project's libraries.

Practice · 5 min

  1. Find out your Python version: on Windows, py --version; on Mac and Linux, python3 --version.
  2. Create a folder called triage, go into it, create the environment with venv, activate it and run the three-line script.
  3. Install numpy with python -m pip install numpy and generate the list with pip freeze.
Deliverable: a file called "My environment sheet", with the Python version, the path the script showed and the list of packages.

Summary

Sources

Read on October 30, 2026.

  1. Python. venv: Creation of virtual environments: activation is not required.
  2. Python. Status of Python versions: support phases and end-of-life dates.
  3. Python. PEP 668: the rule that blocks pip on the Linux system Python.

Lesson quiz

Three situations to apply what you learned.

Lesson 1 of 15

Before moving on to the next lesson

Put what you saw into practice. The boxes stay checked in this browser, so you can come back later.

Have a question about this lesson? The IV Help team answers personally on WhatsApp.

Ask on WhatsApp