首页 > 技术文章 > Python 错误解决方法

PiaYie 2021-12-15 10:11 原文

遇到错误出门右转百度

遇到错误出门左转谷歌

ImportError: DLL load failed while importing ft2font: 找不到指定的模块

 import matplotlib.pyplot as plt
  File "C:\Users\user\anaconda3\lib\site-packages\matplotlib\__init__.py", line 174, in <module>
 _check_versions()
  File "C:\Users\user\anaconda3\lib\site-packages\matplotlib\__init__.py", line 159, in _check_versions
  from . import ft2font
ImportError: DLL load failed while importing ft2font: 找不到指定的模块。

 

很可能是matplotlib的版本过高: 

>pip show matplotlib
Name: matplotlib
Version: 3.3.2
Summary: Python plotting package
Home-page: https://matplotlib.org
Author: John D. Hunter, Michael Droettboom
Author-email: matplotlib-users@python.org
License: PSF
Location: c:\users\user\anaconda3\lib\site-packages
Requires: certifi, cycler, kiwisolver, numpy, pillow, pyparsing, python-dateutil
Required-by: scikit-image, seaborn

我就是装了3.3.2

解决方法:卸载3.3.2版本,重新安装3.3.1版本的matplotlib

>pip uninstall matplotlib
>pip install matplotlib==3.3.1

卸载与安装固定版本的包的操作,举一反三,以后就要会用了

 

推荐阅读