LoginSignup
4
1

More than 5 years have passed since last update.

[備忘]QXcbConnection: Could not connect to display の対処

Posted at

はじめに

ググっても解になかなかたどり着けなかっったので、備忘として残す
同じことで止まってしまった人の助けになれば幸い

事象

pythonでpylabを使って描画しようとした際に以下のエラーが発生した

[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
アボートしました (コアダンプ)

対処

windowsからターミナルを使って、VMのlinux環境へリモートで作業していた
描画の表示には、linuxのデスクトップが必要のよう

VMのアプリケーションでlinuxのデスクトップを開いて、linuxのデスクトップが見れる状態で再度コードを実行するこで、描画の表示ができた

4
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1