LoginSignup
69

More than 5 years have passed since last update.

Bash on Ubuntu on Windows + XmingによるGUI

Last updated at Posted at 2016-07-07

概要

bash on ubuntu on windowsにおいてmaptlotlibやpyqtなどを使用したいときにGUIが必要となる.
それをXmingを使用することにより解決する.

手順

このサイトの動画をもとに進める

エラーが出ることの確認

GUIがないことを確認するために以下のコマンドにてGUIアプリケーションをインストール

username@user: sudo apt-get install x11-apps

インストール終了後,以下のコマンドにてアプリを起動する

username@user: xeyes &

すると以下のようなエラーが出てくるはず

username@user: Error: Can't open display

ここまででエラーの確認はok

Xmingの導入

公式サイトより以下をダウンロードする.

  • Xming-6-9-0-31-setup.exe
  • Xming-fonts-7-5-0-93-setup.exe

ダウンロードしたファイルをインストールし,xmingを起動する.

bashでの設定

右下のステータスバーのXmingにマウスをあてると

Xming server:0.0

のようになっているはず.
次に環境変数DISPLAYの設定を以下のコマンドにて行う.

username@user: export DISPLAY=localhost:0.0

localhost:XXXのXXXには先ほど確認したxming serverの値を入れる.(おそらく0.0のはず)
※.bashrcにexport文を書いておくと起動時に読み込んでくれるのでうれしい

実際に試す

以下のコマンドでウィンドウが出てきたら完了

username@user: xeyes &

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
69