【问题标题】:Python doesnt imports matplotlib, matplotlib doesnt work [closed]Python不导入matplotlib,matplotlib不起作用[关闭]
【发布时间】:2021-04-01 09:20:51
【问题描述】:

所以我搜索了很多,但我无法解决问题。每次我尝试使用 matplotlib 或类似(matplotlib.something)时,python 都无法导入它。它说:

  File "C:\Users\Privacy\ArduConnect.py", line 8, in <module>
    import matplotlib
  File "C:\Users\Privacy\AppData\Roaming\Python\Python39\site-packages\matplotlib\__init__.py", line 107, in <module>
    from . import cbook, rcsetup
  File "C:\Users\Privacy\AppData\Roaming\Python\Python39\site-packages\matplotlib\cbook\__init__.py", line 28, in <module>
    import numpy as np
  File "C:\Users\Privacy\AppData\Roaming\Python\Python39\site-packages\numpy\__init__.py", line 305, in <module>
    _win_os_check()
  File "C:\Users\Privacy\AppData\Roaming\Python\Python39\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\\Privacy\\AppData\\Roaming\\Python\\Python39\\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: "A link to tinyurl but stackoverflow blocks it"

我已经安装了 matplotlib。我必须重新安装 Numpy 吗?究竟如何? 感谢您的支持。

【问题讨论】:

  • 您阅读链接了吗?它准确地告诉你该怎么做

标签: python python-3.x numpy matplotlib


【解决方案1】:

我遇到了同样的问题,你可以解决它:

pip uninstall pandas
python -m pip install numpy==1.19.3
pip install pandas

来自this 微软线程修复将于 2021 年 1 月左右推出。 谢谢。

【讨论】:

  • 有一个更新版本的 numpy [1.19.4]。我不应该安装较新的吗?
  • 较新版本存在您提到的问题,但正如我所说,它将在 2021 年 1 月左右修复。玩得开心
【解决方案2】:

我认为你应该更新这些模块

pip install <modulename> --update
Eg: pip install matplotlib --update

【讨论】:

  • 我做了,但还是不行。
  • 只对所有模块执行此操作,我需要知道您使用的是哪个编辑器或 IDE?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-13
  • 2012-08-12
  • 2021-04-30
  • 2018-01-21
相关资源
最近更新 更多