[英]Python Matplotlib plt.show() does not return the figure
I remote login a server using ssh -X ***@remote.arizona.edu
(This remote server is a Linux system) and tried to make some plots using Python, I had the following errors: 我使用
ssh -X ***@remote.arizona.edu
(此远程服务器是Linux系统)远程登录服务器,并尝试使用Python进行一些绘图,出现以下错误:
_tkinter.TclError: no display name and no $DISPLAY environment variable
Then I fixed this error by the adding the commands before I import any matplotlib
: 然后在导入任何
matplotlib
之前,通过添加命令来修复此错误:
import matplotlib
matplotlib.use('Agg')
matplotlib.matplotlib_fname()
Now it runs well. 现在运行良好。 But the problem is that there is no figure displayed even if I had the command
plt.show()
. 但是问题是,即使我有命令
plt.show()
,也没有显示任何数字。 My old computer used Ubuntu 16.04 before, there is no such problem. 我的旧计算机以前使用过Ubuntu 16.04,没有这样的问题。 Now I switched to MacBook Air, then I had this issue.
现在我改用MacBook Air,然后遇到了这个问题。 It must be some Mac setting issues.
这一定是Mac设置方面的问题。 Any thoughts to fix this issue?
有什么想法可以解决此问题?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.