简体   繁体   English

导入 matplotlib.pyplot 作为 plt 失败

[英]import matplotlib.pyplot as plt fails

At first I could run the inlezen3.py script fine, and I could plot using the matplotlib library.起初,我可以很好地运行 inlezen3.py 脚本,并且可以使用 matplotlib 库进行绘图。 Than suddenly it can no longer find the matplotlib module, I get an error at the following line of code:突然它再也找不到 matplotlib 模块,我在以下代码行中收到错误消息:

import matplotlib.pyplot as plt

The error is that it can't find the matplotlib module:错误是找不到matplotlib模块:

ImportError: DLL load failed: Kan opgegeven module niet vinden.

The whole error traceback:整个错误回溯:

(code) PS C:\Users\Me\dev\2020-08-21_Analyse_Sunridge\code> python inlezen3.py
Traceback (most recent call last):
  File "inlezen3.py", line 14, in <module>
    import matplotlib.pyplot as plt
  File "C:\Users\Me\dev\2020-08-21_Analyse_Sunridge\code\lib\site-packages\matplotlib\__init__.py", line 174, in <module>
    _check_versions()
  File "C:\Users\Me\dev\2020-08-21_Analyse_Sunridge\code\lib\site-packages\matplotlib\__init__.py", line 168, in _check_versions
    module = importlib.import_module(modname)
  File "C:\Users\Me\dev\2020-08-21_Analyse_Sunridge\code\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: Kan opgegeven module niet vinden.
(code) PS C:\Users\Me\dev\2020-08-21_Analyse_Sunridge\code> python inlezen3.py
Traceback (most recent call last):
  File "inlezen3.py", line 14, in <module>
    import matplotlib.pyplot as plt
  File "C:\Users\Me\dev\2020-08-21_Analyse_Sunridge\code\lib\site-packages\matplotlib\__init__.py", line 174, in <module>
    _check_versions()
  File "C:\Users\Me\dev\2020-08-21_Analyse_Sunridge\code\lib\site-packages\matplotlib\__init__.py", line 168, in _check_versions
    module = importlib.import_module(modname)
  File "C:\Users\Me\dev\2020-08-21_Analyse_Sunridge\code\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: Kan opgegeven module niet vinden.

I tried to use a virtual environment, and install all necesarry packages again in this virtual environment.我尝试使用虚拟环境,并在此虚拟​​环境中再次安装所有必需的软件包。 Installing is no problem, but I again get the same can't find module error.安装没问题,但我再次得到同样的找不到模块错误。

Please help请帮忙

我通过卸载 python(在 Windows 应用程序管理器中)并接下来安装 Anaconda 来解决它。

You can re install it in CMD type pip install matplotlib你可以重新安装在 CMD 类型 pip install matplotlib

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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