Search code examples
pythonnumpyinstallationpython-idle

How to install NumPy using official python IDLE?


As seen in the title, I need some help installing NumPy using the official python IDLE. I am running Windows 10 on a Dell computer and I am not sure where to start. I have read through a very similar thread (How do I use Numpy in Python IDLE?) and have not found the help I need. Problem: In many tutorials (Including the official NumPy website), it says to enter: pip install numpy HOWEVER... I am extremely confused as to where to put this. When I enter this into IDLE, it errors out and says, SyntaxError: invalid syntax. Import numpy as np doesn't work either, instead, I receive a different error: Traceback (most recent call last): File "<pyshell#1>", line 1, in <module> import numpy as np ModuleNotFoundError: No module named 'numpy'. Please could somebody help me from the beginning. Thank you.


Solution

  • You have to install numpy from Command Prompt, not IDLE.

    Follow these steps on Windows:

    1. Press the Windows key on your keyboard.
    2. Type CMD and open Command Prompt. A black terminal should open up.
    3. Type 'pip install numpy' and hit enter.
    4. It should start the installation. After you see the "Successfully Installed" message, go back to your IDLE and try importing numpy, it should work.

    NOTE: In case you get a message saying "pip" is not recognized, refer to: https://stackoverflow.com/a/56678271/13699502