John Smith
John Smith

Reputation: 423

Importing numpy from Thonny: ModuleNotFoundError

I typed into the command prompt: C:\Users\JoshPC>pip install numpy

and it said:

Requirement already satisfied: numpy in c:\users\joshpc\appdata\local\programs\python\python36\lib\site-packages

Then in Thonny I wrote:

import numpy as np

and I get the error:

Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'numpy'

So it's some kind of path error, but I am not sure how to solve this.

Upvotes: 2

Views: 32117

Answers (3)

Aivar
Aivar

Reputation: 7012

Thonny uses its own virtual environment by default. Open "Tools => Manage packages" or "Tools => Open system shell" in order to install into this environment.

Upvotes: 8

Dheeraj Teta
Dheeraj Teta

Reputation: 51

I don't know if your python is in the path. following steps will make it easier to install any dependency

  • While installing python change path to C:\Python

    you can install anything with pip like

    c:\Python>pip install numpy c:\Python>pip install 'any_dependency'

Upvotes: 0

bioinfo cheung
bioinfo cheung

Reputation: 1

delete the numpy packages in site-packages manually, and install numpy again using pip

pip install numpy

Good luck!

Upvotes: 0

Related Questions