-2

Please only respond to this post if you use Python on Windows, rather than Mac or Linux.

Error message:

>>> import numpy 
Traceback (most recent call last):
File "stdin", line 1, in <module>
ImportError: No module named 'numpy'

Questions:

  1. Regarding windows 7, python 3.4.3 and numpy-1.9.2, are there any conflicts that would prevent these from working together?

  2. Into which directory (please write out the complete directory path starting with "C:") should I extract the contents of the numpy zip file?

  3. What is the exact command that I need to type into python command prompt in order to install numpy?

Thanks in advance for your assistance

MBT
  • 14,333
  • 16
  • 60
  • 88
Michael Levy
  • 131
  • 1
  • 1
  • 4
  • 1
    People on macos and linux can have experience of window too. – muddyfish Aug 12 '15 at 14:11
  • 1
    possible duplicate of [How do I install Python packages on Windows?](http://stackoverflow.com/questions/1449494/how-do-i-install-python-packages-on-windows) – leo Aug 12 '15 at 14:24
  • EDIT: That question leo concerns python v2.x and doesn't apply in this case. Read this post for python v3.x [previous thread][1] [1]: http://stackoverflow.com/questions/24009413/numpy-wont-install-in-python-3-4-0-in-win7 – Riadh Kalthoumi Aug 12 '15 at 14:26
  • @leo While I may agree this looks like a duplicate, the answers are outdated now, so new questions should not be redirected to it. – Holt Aug 12 '15 at 14:51
  • See [this answer](http://stackoverflow.com/a/31876507/2666289) for some ways of installing `numpy` on Windows. – Holt Aug 12 '15 at 14:53

4 Answers4

1

I was also facing this issue where in I tried using

import numpy

But it has given me error "ImportError: No module named 'numpy'"

I installed numpy using "C:\user>python -mpip install numpy" and it was successfully installed.

However I was again getting the same error

Then I checked that the path where in numpy was intalled was not listed in

import sys print(sys.path)

Then I appended my path wherein numpy was installed using ">>> sys.path.append(r"C:\Users\xxxx\AppData\Roaming\Python\Python38\site-packages").

The above command worked fine, still problem not resolved then I restarted my python session again.

Finally it worked..!!!!(As after every append we have to restart our python session).

  • 1
    Welcome to Stack Overflow! Please note that you were answering to an old question. When answering old question we usually try to make sure that a up to date solution can be found in SO for common problems. In this case, your answer didn't add anything new to the information given from previous answers to this question. Please consider deleting this answer or editing it so it will provide new information regarding anything that has changed and has to do with the problem mentioned above. I'd also suggest trying to give short and practical answers instead of sharing your experiences. – My Koryto Sep 19 '20 at 22:50
0

1) No there isn't.

2) You can use pip. pip install numpy

If you don't have pip installed, install it, its the most often used way of installing python packages. Yes it is possible to do under windows.

3) Once you have the python command prompt, you already have python installed.

muddyfish
  • 2,954
  • 27
  • 35
  • 2) Into which directory (please write out the complete directory path starting with "C:") should I extract the contents of the numpy zip file? (3) I typed "pip install numpy" at the command prompt >>> pip install numpy File "", line 1 pip install numpy ^ SyntaxError: invalid syntax (3) What is the exact command that I need to type into python command prompt in order to install numpy? – Michael Levy Aug 12 '15 at 14:15
  • 2) it doesnt matter and you type it into the __actual__ command line not the python interpreter – muddyfish Aug 12 '15 at 14:18
  • I opened a command prompt C:\Users\Name>pip install numpy 'pip' is not recognized as an internal or external command, operable program or batch file. – Michael Levy Aug 12 '15 at 14:21
  • Then install pip. http://stackoverflow.com/questions/4750806/how-to-install-pip-on-windows – muddyfish Aug 12 '15 at 14:22
  • @ohmy_ohmy If you have a recent version of python, you can run `pip` using `python -m pip install numpy`. – Holt Aug 12 '15 at 14:47
  • From C:\Python34\Scripts> pip install numpy , I obtain "error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat). I guess I have to ask again if there is a simply way to install numpy (i.e., without pip in this case)? Thanks again in advance – Michael Levy Aug 12 '15 at 15:01
0

1) no

2) It doesn't actually matter as pip or the installer will figure that out for you. However, just so you know, pip or whatever will install numpy into your site-packages folder.

3) I recommend downloading the NumPy installer from SourceForge:

Then you don't have to worry about having the right compiler installed. However, if you want to use pip, then you'll need to install the appropriate compiler. This is documented at the following locations:

Community
  • 1
  • 1
Mike Driscoll
  • 31,394
  • 6
  • 39
  • 83
0

I'm not even close to an expert on Python. That said, I like the notion of "keep it simple." I chose to install a Python distribution that already includes numpy. Specifially I installed Python(x,y). Everything seems to be working just fine right after install. I appreciate all those who commented on my question. Thanks

Michael Levy
  • 131
  • 1
  • 1
  • 4