Why the version of sphinx-build and sphinx is different in my OS?

In my friend’s terminal:

sphinx-build --version
sphinx-build 7.2.6
sphinx-quickstart 
Welcome to the Sphinx 7.2.6 quickstart utility.

Both version of sphinx-build and sphinx is 7.2.6.
Check the sphinx version in my OS:

sphinx-build --version
sphinx-build 8.0.2

Start a new project:

sphinx-quickstart docs
Welcome to the Sphinx 5.3.0 quickstart utility.

Why the version of sphinx-build and sphinx is different in my OS?

You might have a weird PATH environment variable setup.

Do you have multiple installations of Python on your machine?

What appears when you run echo $PATH?

What happens when you run which sphinx-quickstart and which sphinx-build? Are the programs in the same folder?

Remove all old version:

sudo apt purge python3-sphinx
sudo rm -f /usr/bin/sphinx-quickstart

Create virtual environment:

sudo apt install python3.11-venv
python3 -m venv project
cd project
source bin/activate
pip3 install sphinx

Done!