简体   繁体   中英

installed numpy but can't import

I have already looked at other questions, but they either haven't been the same situation or haven't worked.

I am using windows 10. I had python 3.6, 3.7, and 3.7.2 (weren't on path) so I downloaded 3.8 and added to path during download.

on cmd did "pip install numpy"

C:\Users\Aidan>pip install numpy
Collecting numpy
  Downloading https://files.pythonhosted.org/packages/34/40/c6eae19892551ff91bdb15f884fef2d42d6f58da55ab18fa540851b48a32/numpy-1.17.4-cp37-cp37m-win_amd64.whl (12.7MB)
     |████████████████████████████████| 12.7MB 3.3MB/s
Installing collected packages: numpy
Successfully installed numpy-1.17.4

C:\Users\Aidan>python.exe -m pip install numpy
Requirement already satisfied: numpy in c:\users\aidan\appdata\local\programs\python\python37\lib\site-packages (1.17.4)

When I go to python 3.8 this happens:

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

and the same happens in 3.7 and 3.6.

I have tried pip uninstall and pip install again.

C:\Users\Aidan>pip uninstall numpy
Uninstalling numpy-1.17.4:
  Would remove:
    c:\users\aidan\appdata\local\programs\python\python37\lib\site-packages\numpy-1.17.4.dist-info\*
    c:\users\aidan\appdata\local\programs\python\python37\lib\site-packages\numpy\*
    c:\users\aidan\appdata\local\programs\python\python37\scripts\f2py.exe
Proceed (y/n)? y
  Successfully uninstalled numpy-1.17.4

C:\Users\Aidan>pip3 install numpy
Collecting numpy
  Using cached https://files.pythonhosted.org/packages/34/40/c6eae19892551ff91bdb15f884fef2d42d6f58da55ab18fa540851b48a32/numpy-1.17.4-cp37-cp37m-win_amd64.whl
Installing collected packages: numpy
Successfully installed numpy-1.17.4

From my research I know that having multiple pythons can be sometimes be a problem, but it never says why or which ones I need to get rid of to make it work. Below I will provide any extra info that may help.

C:\Users\Aidan>pip show numpy
Name: numpy
Version: 1.17.4
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: None
License: BSD
Location: c:\users\aidan\appdata\local\programs\python\python37\lib\site-packages
Requires:
Required-by:


C:\Users\Aidan>python --version
Python 3.7.0

In python 3.8:

>>> import sys
>>> for p in sys.path:
        print (p)



C:\Users\Aidan\AppData\Local\Programs\Python\Python38\Lib\idlelib
C:\Users\Aidan\AppData\Local\Programs\Python\Python38\python38.zip
C:\Users\Aidan\AppData\Local\Programs\Python\Python38\DLLs
C:\Users\Aidan\AppData\Local\Programs\Python\Python38\lib
C:\Users\Aidan\AppData\Local\Programs\Python\Python38
C:\Users\Aidan\AppData\Local\Programs\Python\Python38\lib\site-packages

In python 3.7:

>>> import sys
>>> for p in sys.path:
        print (p)



C:\Users\Aidan\AppData\Local\Programs\Python\Python37-32\Lib\idlelib
C:\Users\Aidan\AppData\Local\Programs\Python\Python37-32\python37.zip
C:\Users\Aidan\AppData\Local\Programs\Python\Python37-32\DLLs
C:\Users\Aidan\AppData\Local\Programs\Python\Python37-32\lib
C:\Users\Aidan\AppData\Local\Programs\Python\Python37-32
C:\Users\Aidan\AppData\Roaming\Python\Python37\site-packages
C:\Users\Aidan\AppData\Local\Programs\Python\Python37-32\lib\site-packages

This was the first time I've ever done anything with path or downloading modules so sorry for being a noob at this stuff.

I think there is a problem with the latest (1.19.4) NumPy version: try installing

pip install numpy==1.19.3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM