I installed Ubuntu 20.04, and python3 (3.8) is installed by default.
To install python3.9, I executed:
sudo apt install python3.9
Thus, I have two versions of Python at my laptop: 3.8 and 3.9.
I’m trying to launch the simple script:
import numpy
With Python 3.8 it works correctly. But, when I interp my script by Python 3.9 the error occurs:
How to solve this problem?
I’ve already tried to update numpy using pip, nothing has happened.
pip3 install numpy --upgrade
2
Answers
You can install a package for a specific version of Python with
For a more consistent python environment look at python venv or a container.
Likely what is happening here is, because you have 2 versions of python installed, your
pip3
command is only installing things for one of the versions, 3.8 in this case.Specifying the python version you want to run your command with will help solve this issue.
For example,
or