_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 …