Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 使用MatPlotLib时出现Python Tkinter错误_Python 3.x_Tkinter - Fatal编程技术网

Python 3.x 使用MatPlotLib时出现Python Tkinter错误

Python 3.x 使用MatPlotLib时出现Python Tkinter错误,python-3.x,tkinter,Python 3.x,Tkinter,有人能帮我处理这个错误消息吗。我正在使用MatPlotLib来绘制一些东西,但是当我调用函数来绘制它时,会收到以下错误消息 使用以下命令之一:-- “上载”以上载文件 “下载”以下载文件 “删除”以删除文件 “DIR”以查看当前目录 下载 输入要下载的文件名!!! break.txt 文件打开 文件关闭() 时间:开始=0结束=158730325.2672875 时间:传输时间=158730325267.287 下载的文件和图表如下所示!! 回溯(最近一次呼叫最后一次): 文件“File_cli

有人能帮我处理这个错误消息吗。我正在使用MatPlotLib来绘制一些东西,但是当我调用函数来绘制它时,会收到以下错误消息

使用以下命令之一:--
“上载”以上载文件
“下载”以下载文件
“删除”以删除文件
“DIR”以查看当前目录
下载
输入要下载的文件名!!!
break.txt
文件打开
文件关闭()
时间:开始=0结束=158730325.2672875
时间:传输时间=158730325267.287
下载的文件和图表如下所示!!
回溯(最近一次呼叫最后一次):
文件“File_client.py”,第117行,在
绘图图(结果)
文件“File_client.py”,第81行,在绘图图中
plt.scatter(list(time_dict.keys()),list(time_dict.values())
文件“/usr/lib/python3/dist packages/matplotlib/pyplot.py”,第3364行,分散显示
ax=gca()
gca中的文件“/usr/lib/python3/dist packages/matplotlib/pyplot.py”,第962行
返回gcf().gca(**kwargs)
gcf中的文件“/usr/lib/python3/dist packages/matplotlib/pyplot.py”,第592行
返回数字()
文件“/usr/lib/python3/dist packages/matplotlib/pyplot.py”,图中第539行
**kwargs)
文件“/usr/lib/python3/dist packages/matplotlib/backend_base.py”,第171行,在new_figure_manager中
返回cls.new\u figure\u manager\u给定\u figure(数值,图)
文件“/usr/lib/python3/dist packages/matplotlib/backends/backend\u tkagg.py”,第1049行,在n ew\u图\u manager\u给定图中
window=Tk.Tk(className=“matplotlib”)
文件“/usr/lib/python3.6/tkinter/_init__.py”,第2023行,在_init中__
self.tk=\u tkinter.create(屏幕名、基本名、类名、交互、wantobjects、useT k、同步、使用)
_tkinter.TclError:没有显示名称和$display环境变量

以文本形式添加错误消息您是否在没有图形桌面环境的环境中运行应用程序,如ssh或online?@acw1668我正在putty中运行它。那么您很可能正在使用ssh。如果您的主机是Windows,请在PuTTY中启用X11转发并运行X服务器。以文本形式添加错误消息您是否在没有图形桌面环境(如ssh或online)的环境中运行应用程序?@acw1668我正在PuTTY中运行它。那么您很可能正在使用ssh。如果您的主机是Windows,请在PuTTY中启用X11转发并运行X服务器。
Use one of following commands are :: --
'UPLOAD' to upload a file
'DOWNLOAD' to download a file
'DELETE' to delete a file
'DIR' to view the current directories
DOWNLOAD
enter the name of the file to download!!!
break.txt
file opened
file close()
time:  start =  0  end =  1587306325.2672875
time:  transfer_time =  1587306325267.287
file downloaded and graph is shown below!!
Traceback (most recent call last):
  File "file_client.py", line 117, in <module>
    plot_graph(result)
  File "file_client.py", line 81, in plot_graph
    plt.scatter(list(time_dict.keys()), list(time_dict.values()))
  File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 3364, in scatter
    ax = gca()
  File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 962, in gca
    return gcf().gca(**kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 592, in gcf
    return figure()
  File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 539, in figure
    **kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line 171, in new_figure_                                                                                                manager
    return cls.new_figure_manager_given_figure(num, fig)
  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_tkagg.py", line 1049, in n                                                                                                ew_figure_manager_given_figure
    window = Tk.Tk(className="matplotlib")
  File "/usr/lib/python3.6/tkinter/__init__.py", line 2023, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useT                                                                                                k, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable