在导入matplotlib时出现找不到指定的模块问题,但确实安装了matplotlib库
import matplotlib.pyplot as plt
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\87316\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\__init__.py", line 200, in <module> _check_versions() File "C:\Users\87316\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\__init__.py", line 194, in _check_versions module = importlib.import_module(modname) File "C:\Users\87316\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: DLL load failed: 找不到指定的模块。
解决办法:
step1:查看先前下载版本
pip show matplotlib #如果Version: 3.1.0
step2:安装version=2.2.2版本
pip install matplotlib==2.2.2
’’’ Name: matplotlib Version: 2.2.2 Summary: Python plotting package Home-page: http://matplotlib.org Author: John D. Hunter, Michael Droettboom Author-email: matplotlib-users@python.org License: BSD Location: c:\users\87316\appdata\local\programs\python\python37\lib\site-packages Requires: cycler, kiwisolver, pyparsing, numpy, six, pytz, python-dateutil Required-by: -javaagent:D:\course content\java\new\ideaIU-2018.1.5.win\bin\JetbrainsCrack-2.9-release-enc.jar ‘‘‘
完美解决!