小编Gaf*_*aff的帖子

在 PyCharm 中使用 matplotlib 时出错:没有属性 'FigureCanvas'

我有这个代码:

import matplotlib.pyplot as p1lt

#define data
x = [1, 2, 3, 4, 5, 6]
y = [3, 7, 14, 19, 15, 11]

#create line plot
p1lt.plot(x, y)

#show line plot

p1lt.show()
Run Code Online (Sandbox Code Playgroud)

我收到一条错误消息:

Matplotlib support failed 
Traceback (most recent call last): 
  File "C:\Users\G\AppData\Roaming\JetBrains\IdeaIC2022.2\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 25, in do_import
    succeeded = activate_func() 
  File "C:\Users\G\AppData\Roaming\JetBrains\IdeaIC2022.2\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_code_executor.py", line 29, in <lambda>
    "matplotlib": lambda: activate_matplotlib(self.enableGui), 
  File "C:\Users\G\AppData\Roaming\JetBrains\IdeaIC2022.2\plugins\python-ce\helpers\pydev\pydev_ipython\matplotlibtools.py", line 110, in activate_matplotlib
    gui, backend = find_gui_and_backend() 
  File "C:\Users\G\AppData\Roaming\JetBrains\IdeaIC2022.2\plugins\python-ce\helpers\pydev\pydev_ipython\matplotlibtools.py", line 47, in find_gui_and_backend
    backend = matplotlib.rcParams['backend'] 
  File "D:\books\programming\python17\lib\site-packages\matplotlib\__init__.py", …
Run Code Online (Sandbox Code Playgroud)

python plot matplotlib

17
推荐指数
1
解决办法
3万
查看次数

标签 统计

matplotlib ×1

plot ×1

python ×1