0

when i type:

import numpy as np

i get this error:

Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'

i tried to install like :

pip3 install numpy

but this error comes up on the word 'install':

SyntaxError: invalid syntax

i'm working on python 3.7.4 on windows8 32bits i know it might be trivia but i'm just starting with python

F.Abdullah
  • 19
  • 1
  • 1
  • `python -m pip install numpy` – nathancy Aug 29 '19 at 03:08
  • Please try `python -m pip install numpy`, or using full path to python. But I would recommend you to use Anaconda, if your needs related to data science, not engineering. – hunzter Aug 29 '19 at 03:10
  • please visit this Q&A https://stackoverflow.com/questions/12628164/trouble-installing-scipy-on-windows/42664324#42664324 – R.A.Munna Aug 29 '19 at 04:46

4 Answers4

2

Did you install pip first? If not, follow this:

  1. Download get-pip.py to a folder on your computer.
  2. Open a command prompt and navigate to the folder containing get-pip.py.
  3. Run the following command:

python get-pip.py

You can verify that Pip was installed correctly by opening a command prompt and entering the following command:

pip -V

You should see output similar to the following:

pip 18.0 from c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\pip (python 3.7)

Go to the folder that your pip is located and run your command:

cd c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\pip
pip install numpy
Scott
  • 4,974
  • 6
  • 35
  • 62
0

you should first quit the command line of python and then type pip install numpy in the cmd

fir
  • 3
  • 1
  • 4
0

First, check are you outside the command line, if yes then

Try

python -m pip install --upgrade pip

then

python -m pip install numpy

If it did not work, try adding python and pip full path in the commands.

Arun Augustine
  • 1,690
  • 1
  • 13
  • 20
0

One simple way of doing this is by using PyCharm, which can be downloaded for free.
Simply open your project in it, or create a temporary one, go to settings, project settings, and then to project interpreter. Here you can add your current python interpreter or create a new one, and then just press the add button to add libraries into that interpreter.
Now when you use that interpreter in or out of PyCharm, you will have access to any of those libraries you added.
This is not the best way of doing this, however, it is a sure way of making it work, and PyCharm is a great IDE for Python.

Pencilcaseman
  • 360
  • 6
  • 16