Importing libraries into Python

In this forum members can discuss topics about specific programming languages.
Post Reply
ArryMan
Posts: 3
Joined: Wed Oct 23, 2019 9:31 am

Importing libraries into Python

Post by ArryMan » Wed Nov 06, 2019 12:04 pm

I have Python 3.7, running under Idle. I want to import nympy routines but the library isn't recognised. Math and Itertools etc are imported successfully.

I installed Anaconda on my machine, and everthing it has to offer, including nympy. I assumed it would sort out the path problems for me so that I could use the libraries outside of Anaconda, but it's not working. Any suggestions, please?

LilStalker
Posts: 64
Joined: Thu Nov 03, 2016 4:32 pm

Re: Importing libraries into Python

Post by LilStalker » Wed Nov 06, 2019 8:46 pm

Do you mean numpy?
Image

ArryMan
Posts: 3
Joined: Wed Oct 23, 2019 9:31 am

Re: Importing libraries into Python

Post by ArryMan » Thu Nov 07, 2019 9:33 am

Yep! (must remember to wear specs when staring at computer screen . . .). But still get this error:
ModuleNotFoundError: No module named 'numpy'

LilStalker
Posts: 64
Joined: Thu Nov 03, 2016 4:32 pm

Re: Importing libraries into Python

Post by LilStalker » Fri Nov 08, 2019 7:44 am

And now you first have to download the library from the internet. Some libraries come immediately with Python download and some you need to download manually.
The easiest way to do it is to call:

"pip install numpy" in the command line.

If that doesnt work, google how to install numpy and you should find enough material on how to fix the problem.
Image

ArryMan
Posts: 3
Joined: Wed Oct 23, 2019 9:31 am

Re: Importing libraries into Python

Post by ArryMan » Fri Nov 08, 2019 8:07 am

Thanks, LilStalker. I tried that, and here is the script:

(base) DavidsiMac2854:~ davidellis$ pip install numpy
Requirement already satisfied: numpy in ./opt/anaconda3/lib/python3.7/site-packages (1.17.2)


As mentioned before, I hoped anaconda would take care of the path thing for me as I don't know how to do this. Somehow I have to let idle know where numpy is when I try to import it. The website didn't help on this.

Dave.

Post Reply