[Note] QXcbConnection: Could not connect to display

Introduction

I couldn't find a solution even if I googled, so I will leave it as a reminder I hope it helps people who have stopped doing the same thing.

Event

The following error occurred when trying to draw using pylab in python

[root@localhost ~]# python
>>> from sklearn.datasets import load_digits
>>> digits = load_digits()
>>> print digits.data.shape
(1797, 64)
>>> import pylab as pl 
>>> pl.gray() 
>>> pl.matshow(digits.images[0]) 
>>> pl.show() 
QXcbConnection: Could not connect to display
Aborted(Core dump)

Coping

I was working remotely from windows to the linux environment of the VM using a terminal It seems that you need a linux desktop to display the drawings

By opening the linux desktop with the VM application and executing the code again with the linux desktop visible, I was able to display the drawing.

Recommended Posts

[Note] QXcbConnection: Could not connect to display
Could not update pip due to ssl
Easy display of binance board information (could not)
Connect to mysql
How to display images continuously with matplotlib Note
Note that int64 could not be received by pyOSC
Connect python to mysql
How to check when python-memcached server could not be connected
Check when the Docker container does not connect to the Internet