» pip install numpy
Videos
A coworker sent me a Python file that uses numpy, so when I tried to run it, I got the error "No module named 'numpy'". So I looked up numpy, and it said in order to get that, I needed either conda or pip. so I looked up how to get conda, and it said I had to first download Anaconda. So I download Anaconda. I look in there and it would seem to me that both conda and numpy are already in there: Under Environments, both conda and numpy are listed as installed. But then I went back and tried to run the program again, and I got the same error. What else do I need to do to access numpy?
Also, idk if this matters, but I'm running Python on IDLE. Do I need to use a different IDE?
Check the installation of Python 2.7, and then install/reinstall pip which is described here. Then a open command line windows and write:
pip install numpy
Or
pip install scipy
If already installed, try this:
pip install -U numpy
Installing extension modules can be an issue with pip. This is why Conda exists. Conda is an open-source BSD-licensed cross-platform package manager. It can easily install NumPy.
Two options:
- Install Anaconda here
- Install Miniconda here and then go to a command line and type
conda install numpy(make sure your PATH includes the location Conda was installed to).
Factsheet
You have to install numpy from Command Prompt, not IDLE.
Follow these steps on Windows:
- Press the Windows key on your keyboard.
- Type CMD and open Command Prompt. A black terminal should open up.
- Type 'pip install numpy' and hit enter.
- 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
You write pip install numpy in the command prompt (CMD) if you are on Windows.
And, most of the times py -m pip install numpy helps more on Windows.
On macOS/Unix, you can use python -m pip install numpy in terminal/console.