无法导入matplotlib,vscode说“没有名为matplotlib的模块”

时间:2020-11-04 18:58:13

标签: python python-3.x numpy matplotlib pip

我无法导入matplotlib或numpy。

试图通过cmd导入软件包(在cmd中打开python控制台),而vscode会引发不同的错误。

cmd错误

 ** On entry to DGEBAL parameter number  3 had an illegal value
 ** On entry to DGEHRD  parameter number  2 had an illegal value
 ** On entry to DORGHR DORGQR parameter number  2 had an illegal value
 ** On entry to DHSEQR parameter number  4 had an illegal value
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\as116\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\__init__.py", line 107, in <module>
    from . import cbook, rcsetup
  File "C:\Users\as116\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\cbook\__init__.py", line 28, in <module>
    import numpy as np
  File "C:\Users\as116\AppData\Local\Programs\Python\Python38\lib\site-packages\numpy\__init__.py", line 305, in <module>
    _win_os_check()
  File "C:\Users\as116\AppData\Local\Programs\Python\Python38\lib\site-packages\numpy\__init__.py", line 302, in _win_os_check
    raise RuntimeError(msg.format(__file__)) from None
RuntimeError: The current Numpy installation ('C:\\Users\\as116\\AppData\\Local\\Programs\\Python\\Python38\\lib\\site-packages\\numpy\\__init__.py') fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: <tiniyurl not allowed to post here>

vscode错误

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

由于未知原因,我遇到了多个问题(关于python和vscode),我要完成一项作业,所以今天我不得不重置我的PC(Windows功能,该功能可以保留个人文件,但删除应用程序)。我安装了python 3.9,但卸载了它并安装了python 3.8.6,同时尝试找出错误。

重置计算机之前,我根本无法安装matplotlib和numpy。

1 个答案:

答案 0 :(得分:-2)

使用numpy1.19.4时遇到相同的问题。

安装了1.19.3并可以运行...

从该线程How do you fix "runtimeError: package fails to pass a sanity check" for numpy and pandas? “使用python3.9和numpy1.19.4时会发生此错误,因此卸载numpy1.19.4并安装1.19.3即可。”