1

I have to import numpy for a project in python, and I was told to simply install it in the CMD prompt, (pip install numpy). It says it is installed, but when I try to import it in python, it says: no module named 'numpy'. What did I do wrong or how do I fix this?

2 Answers2

1

If you are using python version that is lower than 3 the method you tried should work so I am assuming you have a python version of 3.x.

For that you have to use

pip3 install numpy

As pip is for version lower than python 3 but pip3 is the one for python3.

EDIT

Since you said that it works in command prompt, so I believe that the pycharm is not using python3...?

If that’s the case try visiting here and set the appropriate version.

Hope it helps

Rajat Shenoi
  • 590
  • 2
  • 7
  • 22
0

Hi if you want to ensure you are using the python and pip in the same bin and the installation of numpy is also in the same bin, you can try:

$ python -m pip install numpy
hongkail
  • 679
  • 1
  • 10
  • 17