Could not connect to any X display.

    科技2024-06-30  64

    综述

    Could not connect to display local host: Could not connect to any X display.

    原因

    因为我的代码里有:

    plt.imshow(images[0, ..., :3].cpu().numpy())

    暂时无法显示。因为我没有配置服务器图形化界面。

    解决

    删除

    plt.imshow(images[0, ..., :3].cpu().numpy())

    先将图片保存到本地在查看

    import matplotlib matplotlib.use('Agg') plt.imsave('filename.png',texture_image.squeeze().cpu().numpy())

    即可。 即将绘制的backend设置为AGG: raster graphics – high quality images using the Anti-Grain Geometry engine.

    Processed: 0.020, SQL: 8