python代码在linux终端中执行报错:Unable to init server: Could not connect: Connection refused
python代码在linux终端中执行时报错:
Unable to init server: Could not connect: Connection refused
Unable to init server: 无法连接: Connection refused
解决办法:
在要执行的python文件里加入以下两句代码:
切记:在最开头添加。
import matplotlib matplotlib.use('Agg')