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.
- Find out which Python answers on your computer
- Create a separate environment for each project
- Understand what the graphics card requires
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.
| System | How to install | Careful |
|---|---|---|
| Windows | python.org; use the py command | If the store opens, turn on the Python aliases |
| Mac | python.org; use python3 | Do not touch Apple's Python |
| Linux | Whatever the distribution ships | Install 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
- Find out your Python version: on Windows,
py --version; on Mac and Linux,python3 --version. - Create a folder called triage, go into it, create the environment with venv, activate it and run the three-line script.
- Install numpy with
python -m pip install numpyand generate the list withpip freeze.
Summary
- The Python that answers is the first one the computer finds. Check with the script.
- Use a version that still gets fixes. In October 2026, that is 3.14.
- Each project has its own environment. Keep the list, not the folder.
- The card has three layers: engine, driver and request.
Sources
Read on October 30, 2026.
- Python. venv: Creation of virtual environments: activation is not required.
- Python. Status of Python versions: support phases and end-of-life dates.
- Python. PEP 668: the rule that blocks pip on the Linux system Python.
Lesson quiz
Three situations to apply what you learned.
Isaque Victor free courses