Python Error ModuleNotFoundError No module named moduleName

0 votes

I am trying to import several modules that I know for a fact that are installed, but I am getting the ModuleNotFoundError: No module named '' error.

$ sudo -H pip install numpy
    Requirement already satisfied: numpy in /usr/local/lib/python3.6/site-packages (1.18.1)
$ python3

Python 3.6.9 (default) 
>>> import numpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'
>>> import PrettyTable
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PrettyTable'

Can you advise me on how to fix this problem?

Nov 22, 2020 in Python by Roshni
• 10,420 points
2,824 views

1 answer to this question.

0 votes

Python3 and pip are most likely pointing to different versions of python. Try the following:

sudo python3 -m pip install numpy

This will use the pip command associated with the python3 environment.

answered Nov 22, 2020 by Gitika
• 65,870 points

Related Questions In Python

0 votes
1 answer

Python error "ImportError: No module named pygame.locals"

You need to download and install the ...READ MORE

answered Jun 18, 2019 in Python by Greg
3,418 views
0 votes
2 answers

Python error " import requests ImportError: No module named requests"

Hello, Open Cmd or Powershell as Admin. type pip ...READ MORE

answered Nov 28, 2020 in Python by Rohan
• 200 points
11,832 views
0 votes
1 answer
0 votes
2 answers

Python error "ImportError: No module named 'tkinter'"

sudo apt-get install python3-tk Then, >> import tkinter # ...READ MORE

answered Nov 9, 2019 in Python by Icetutor
• 160 points
15,566 views
+1 vote
3 answers
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,970 views
0 votes
0 answers
+2 votes
3 answers

ModuleNotFoundError: No module named 'Crypto'

The module you’ve installed is different. To install ...READ MORE

answered Aug 20, 2019 in Python by Raman
29,811 views