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.
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)
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