_tkinter.TclError:没有显示名称,也没有 $DISPLAY 环境变量
我正在服务器中运行一个简单的 python 脚本: import matplotlib.pyplot as plt import numpy as np x = np.random.randn(60) y = np.random.randn(60) plt.scatter(x, y, s=20) out_png = 'path/to/store/out_file.png' plt.savefig(out_png, dpi=150) 我尝试使用命令python example.py在安装了 matplotlib 1.5.1 的服务器中,它失败并出现错误: Traceback (most recent call last): File "example.py", line 7, in <module> plt.scatter(x, y, s=20) File "/home/USER/.virtualenvs/nnet/lib/python2.7/site-packages/matplotlib/pyplot.py", line 3241, in scatter ax = gca() File "/home/USER/.virtualenvs/nnet/lib/python2.7/site-packages/matplotlib/pyplot.py", line 928, in gca return gcf().gca(**kwargs) File "/home/USER/.virtualenvs/nnet/lib/python2.7/site-packages/matplotlib/pyplot.py", line 578, in gcf return figure() File "/home/USER/....