-1

I trying to run a program in python 3 that uses numpy but it gives me the error ModuleNotFoundError: No module named 'numpy'. I am using Windows 10. I tried running pip install numpy and it says pip is not a recognized command

T. Green
  • 323
  • 10
  • 20

2 Answers2

1

Add "way to folder with your python interpreter" and "way to folder with your python interpreter"\Scripts\ to PATH variable. Computer -> Properties -> Extra options -> Environment variables.

Andrii Matiiash
  • 499
  • 6
  • 18
  • @T.Green Just for future reference if you have tried something please include that in your question. Let us know all of the debugging steps that you have already tried so it makes it easier for us to know how to help you instead of having us make suggestions on how to fix it and then afterwards telling us that you already tried that. – Marcello B. Nov 23 '17 at 17:22
1

You need to add python to your environment variables

  1. Computer -> System Properties (or Win+Break) -> Advanced System Settings
  2. Click the Environment variables button (in the Advanced tab)
  3. Edit PATH and append ;C:\Python27 to the end (if you need substitute your Python version)
  4. Click OK. Note that changes to the PATH are only reflected in command prompts opened after the change took place.

If you are running python 3.6 you will need to add python to your environment path through command prompt

Windows allows environment variables to be configured permanently at both the User level and the System level, or temporarily in a command prompt.

To temporarily set environment variables, open Command Prompt and use the set command:

set PATH=C:\Program Files\Python 3.6;%PATH%
set PYTHONPATH=%PYTHONPATH%;C:\My_python_lib

These changes will apply to any further commands executed in that console and will be inherited by any applications started from the console.

To change System variables, you need non-restricted access to your machine (i.e. Administrator rights).

If you were to run python -v it should now work

This came directly from the python documents section 3.3.1


Now after you restart you should be able to access python through the command line. If you are running 2.7.9+ or 3.4+ pip will come prepackaged with python. However, if you are running an earlier version of python

Per https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip:

Download get-pip.py, being careful to save it as a .py file rather than .txt. Then, run it from the command prompt:

python get-pip.py You possibly need an administrator command prompt to do this. Follow Start a Command Prompt as an Administrator (Microsoft TechNet).

Thanks to How do I install pip on Windows?

Marcello B.
  • 4,177
  • 11
  • 45
  • 65
  • Have you installed python already? What version of python are you running? – Marcello B. Nov 23 '17 at 17:16
  • I have 2.7 and 3.6.3 but I only wan to use 3.6.3 – T. Green Nov 23 '17 at 17:17
  • Ok, well you would need to change the `python27` to `python36` (however I do not run windows and I cannot be 100% sure). Please read section 3.3.1 in this article to set up an environment path for 3.6 in windows https://docs.python.org/3/using/windows.html – Marcello B. Nov 23 '17 at 17:19
  • I modified the python installer to add python to environment variables so now it works! Thank you so much for your help :) – T. Green Nov 23 '17 at 17:25
  • No worries! I have modified my answer to contain the steps that was able to get you up and going. – Marcello B. Nov 23 '17 at 17:27