首页 Paddle框架 帖子详情
终端测试matploitlib报错
收藏
快速回复
Paddle框架 问答深度学习 605 2
终端测试matploitlib报错
收藏
快速回复
Paddle框架 问答深度学习 605 2

这是测试代码:

import numpy as np 
from matplotlib import pyplot as plt 
 
x = np.arange(1,11) 
y =  2  * x +  5 
plt.title("Matplotlib demo") 
plt.xlabel("x axis caption") 
plt.ylabel("y axis caption") 
plt.plot(x,y) 
plt.show()

这是报错信息:

raceback (most recent call last):
File "matploitDemo.py", line 6, in
plt.title("Matplotlib demo")
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/pyplot.py", line 1419, in title
return gca().set_title(s, *args, **kwargs)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/pyplot.py", line 969, in gca
return gcf().gca(**kwargs)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/pyplot.py", line 586, in gcf
return figure()
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/pyplot.py", line 533, in figure
**kwargs)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 161, in new_figure_manager
return cls.new_figure_manager_given_figure(num, fig)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/backends/_backend_tk.py", line 1046, in new_figure_manager_given_figure
window = Tk.Tk(className="matplotlib")
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/tkinter/__init__.py", line 2023, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

0
收藏
回复
全部评论(2)
时间顺序
AIStudio810261
#2 回复于2021-05

大哥, 您见过几个人能在terminal里画图的.......................matplotlib 只能在notebook里面用

0
回复
AIStudio810260
#3 回复于2021-05

AI Studio环境不是本地,运行没法弹窗啊

0
回复
需求/bug反馈?一键提issue告诉我们
发现bug?如果您知道修复办法,欢迎提pr直接参与建设飞桨~
在@后输入用户全名并按空格结束,可艾特全站任一用户