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,480 points
6,939 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,770 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
7,032 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
17,480 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
24,721 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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,464 views
0 votes
1 answer
+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
81,263 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP