简体   繁体   English

在 python 中运行程序时出现导入错误,出现以下错误消息

[英]import error while running a program in python the following error message occurred

while running a program in python the following error message occurred.在 python 中运行程序时出现以下错误消息。

Traceback (most recent call last): File "C:\Users\Student\AppData\Local\Programs\Python\Python38-32\python\cos.py", line 7, in import matplotlib.pyplot as plt File "C:\Users\Student\AppData\Local\Programs\Python\Python38-32\lib\site-packages\matplotlib_ init _.py", line 174, in check_versions() File "C:\Users\Student\AppData\Local\Programs\Python\Python38-32\lib\site-packages\matplotlib_ init .py", line 159, in _check_versions from. Traceback(最近一次调用最后一次):文件“C:\Users\Student\AppData\Local\Programs\Python\Python38-32\python\cos.py”,第 7 行,导入 matplotlib.pyplot 作为 plt 文件“C: \Users\Student\AppData\Local\Programs\Python\Python38-32\lib\site-packages\matplotlib_ init _.py”,第 174 行,在check_versions() 文件“C:\Users\Student\AppData\Local\ Programs\Python\Python38-32\lib\site-packages\ matplotlib_init .py”,第 159 行,在 _check_versions 中。 import ft2font ImportError: DLL load failed while importing ft2font: The specified module could not be found. import ft2font ImportError: DLL load failed while importing ft2font: 找不到指定的模块。

This error message means that (f2tfont.cpp does not compile) First这个错误信息的意思是(f2tfont.cpp 不编译)首先

pip uninstall matplotlib 
pip install -U matplotlib==3.2.0rc1

If this does not work out如果这不成功

You need to have Visual Studio c++ in Your System.您的系统中需要有 Visual Studio c++。

Install Visual Studio 2019 with c++ distributions.安装带有 c++ 发行版的 Visual Studio 2019。

i hope this will fix your error我希望这能解决你的错误

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

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