-1

I am using Linux Mint 19.3 XFCE.

I have installed Numpy through pip3. pip3 was not installed already, and I installed pip3 thorugh apt.

The default version of python3 that came with the OS is 3.6.9. Since I am not supposed to change the default version of Python that comes installed with the OS, I kept that. And I installed a newer version, 3.8.0 with snap.

The command was-

sudo snap install python38

And now, whenever I need to work with the interpreter, I just type python38 into the terminal and get on with it.

I recently installed Numpy with pip3-

pip3 install numpy

and it shows up when I run pip3 freeze :

It is listed as-

numpy==1.18.1

But when I enter the Python interpreter through typing python38 into my terminal, and type in import numpy, I am shown an error:

import numpy as np

Traceback (most recent call last):

File "", line 1, in

ModuleNotFoundError: No module named 'numpy'

However, when I try the same with Python 3.6.9, it works. Numpy is improted, works just fine. (This time I enter Python interpreter by typing python3)

Now, how do I permanently solve this? That is, being able to import Numpy when working in Python 3.8 in terminal.

Community
  • 1
  • 1
truth
  • 329
  • 3
  • 14

1 Answers1

0

This may be the reason because your pip is configured for the default version of python in the machine(Python 3.6.9 in your case). You may change your default python version.
Or You could run pip and install your python package for specific python version like

python_version -m pip install your_package

eg

python38 -m pip install numpy