简体   繁体   English

ImportError:无法从“matplotlib”导入名称“样式”

[英]ImportError: cannot import name 'styles' from 'matplotlib'

The issue is in the title:问题在标题中:

ImportError: cannot import name 'styles' from 'matplotlib' 

I have tried the recommended answers, I have used我试过推荐的答案,我用过

sudo pip install --upgrade matplotlib

and

pip install --user --upgrade matplotlib

and still have the same error as before.并且仍然有与以前相同的错误。

Code:代码:

import tkinter as tk
from tkinter import ttk
import matplotlib
from matplotlib import styles

LARGE_FONT = ("Verdana", 12)

error:错误:

ImportError: cannot import name 'styles' from 'matplotlib' 
 (/Users/myname/opt/anaconda3/lib/python3.7/site-packages/matplotlib/__init__.py)

I have tried this with a few python versions in vs code (3.6.6, 3.7.6, 3.8.1) and Anaconda Spyder (which I believe is 3.7.x but I'm not sure which) and get the same error.我已经在 vs 代码(3.6.6、3.7.6、3.8.1)和 Anaconda Spyder(我相信是 3.7.x 但我不确定是哪个)中尝试了几个 python 版本并得到了同样的错误。

Any ideas or is Matplotlib styles not useable anymore?有什么想法或者 Matplotlib styles 不再可用了吗?

Do you mean 'style' instead of 'styles'?你的意思是“风格”而不是“风格”?

from matplotlib import style

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

相关问题 导入错误:无法从“matplotlib”导入名称“rcParams” - ImportError: cannot import name 'rcParams' from 'matplotlib' ImportError:无法从“matplotlib”导入名称“_png” - ImportError: cannot import name '_png' from 'matplotlib' 来自matplotlib导入样式ImportError:无法导入名称'style' - from matplotlib import style ImportError: cannot import name 'style' ImportError:无法导入名称mpl(从matplotlib导入mpl) - ImportError: cannot import name mpl (from matplotlib import mpl) 导入错误:无法导入名称'_path' matplotlib - ImportError: cannot import name '_path' matplotlib matplotlib:导入错误:无法导入名称“pyplot” - matplotlib: ImportError: cannot import name 'pyplot' matplotlib ImportError:无法导入名称'style' - matplotlib ImportError: cannot import name 'style' 从 openpyxl.styles 导入样式,字体导入错误:无法导入名称样式 - from openpyxl.styles import Style, Font ImportError: cannot import name Style ImportError:无法在Kivy Matplotlib后端上从'matplotlib.font_manager'错误导入名称'weight_as_number' - ImportError: cannot import name 'weight_as_number' from 'matplotlib.font_manager' ERROR on Kivy Matplotlib backend 从 matplotlib.backends 导入 _tkagg 导入错误:无法导入名称 _tkagg - from matplotlib.backends import _tkagg ImportError: cannot import name _tkagg
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM