安装了numpy但无法导入

时间:2019-11-13 12:10:27

标签: python numpy module pip importerror

我已经看过其他问题,但是它们不是相同的情况,或者没有起作用。

我正在使用Windows 10 我有python 3.6、3.7、3.7.2(不在路径上),所以我下载了3.8,并在下载过程中添加到了路径

在cmd上执行了“ pip install numpy”

onActivityResult(int requestCode, int resultCode, @Nullable Intent data)

当我使用python 3.8时,会发生以下情况:

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)

在3.7和3.6中也是如此

我尝试了pip卸载并再次安装pip。

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

从我的研究中,我知道有时使用多个python可能是一个问题,但它从未说明为什么或需要摆脱哪些使它起作用。 下面,我将提供任何可能有用的额外信息。

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

在python 3.8中

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

在python 3.7中

>>> 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

这是我第一次使用路径或下载模块来完成任何操作,非常抱歉对这个东西不屑一顾

1 个答案:

答案 0 :(得分:0)

我认为最新(1.19.4)NumPy版本存在问题:尝试安装

pip install numpy==1.19.3