6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

IPython Qt Consoleを使いたい

Last updated at Posted at 2015-04-25

IPython Qt Consoleを実行するのに必要なもの

Windowsだと、よく使われるようなパッケージが最初から入っているWinPythonっていう便利なものがあるんで、IPython Qt Consoleもなんのパッケージの追加もなく使えるようになっている。
Macだと自分でパッケージをインストールしないといけないので使えるようにするまでがなかなか大変。
IPython Qt Consoleを起動しようとするとエラーメッセージが表示されるので必要なパッケージを確認できる。

$ ipython qtconsle
...
ImportError: 
    Could not load requested Qt binding. Please ensure that
    PyQt4 >= 4.7, PyQt5 or PySide >= 1.0.3 is available,
    and only one is imported per session.

必要なのはPyQt4, PyQt5, PySideのいずれか。

PyQt5をインストール

まずは下のサイトを参考に最新のPyQt5のインストールを試みる。

PySide(Qt4)とPyQt(Qt5)に必要な環境変数をセットする
PyQt5はpipでインストールできないのでHomebrewでインストールする必要があるらしい。

Installing PyQt5
公式サイト

とりあえず依存するパッケージを調べてみると、

$ brew info pyqt5
...
==> Dependencies
Required: qt5 ✘, sip ✘

qt5とsipをインストールしてからPyQt5をインストール。

$ brew install qt5
...
$ brew install sip
...
$ brew install pyqt5

IPython Qt Consoleの起動

もう一度起動を試してみると、今度は別のエラー。

$ ipython qtconsole
...
ImportError: No module named 'pygments'
$ pip install pygments
...
$ ipython qtconsole
...
ImportError: No module named 'zmq'
$ pip istall pyzmq
...
$ ipython qtconsole

pipでpygmentsとpyzmqをインストールしてようやく起動できた。


MacにもWinPythonみたいなのがあるといいんだけど。

6
5
0

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
6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?