LoginSignup
10
15

More than 5 years have passed since last update.

wxPythonに関して

Last updated at Posted at 2017-08-19

はじめに

大した話ではないけど、1時間くらいハマったので備忘録としてメモ。
今回しようとしたことはMayaviを使ったプログラムのデバックをして欲しいと言う依頼が来たので環境を整える際にwxPythonをインストールする必要が出て来てハマった話。

環境

pyenvで使用する環境を切り替えられるようにしている。
今回の環境はAnaconda-2.4.4.0。

したこと

単純にMayaviを入れようと次のコマンドを叩いてインストールした。

conda install -c anaconda mayavi

まずは、これでMayavi自体は手に入ったのだが、Traitsというモジュールでエラーが発生。
その理由は必要なモジュールが足りないよっというもの。
仕方なく、足りていないモジュールは何か探したらそれはwxPythonだったため次のコマンドでインストールした。

conda install -c anaconda wxpython

さて、これで動くかな?っと思うと次のエラーメッセージが表示された。

This program needs access to the screen.
Please run with a Framework build of python, and only when you are
logged in on the main display of your Mac.

う〜ん、パスも正常だし、ちゃんとconda listでも入っているの確認できるし、なんだコレ。っと思ってGoogle先生に聞いて色々みんなのQ&Aを見てたけど、どれも解決にはいたらず...

結論

ようやく見つけたのがGoogleグループでのやりとりのこちら。

ここで、Travis Oliphantさんという回答が次のもの。

Anaconda is not a Framework build of python. However, you should be able to still run the program using "pythonw" which runs python with the correct options to run the GUI.

pythonw simple.py

It should be on your PATH

そうなのか。 Anaconda上には'Framework build of python'というものは存在しないらしい。
なので、動かしたいならpythonwで動かす必要あるらしい。

そして、

pythonw main.py

として動かしたところちゃんと動作した(∩・∀・)∩

10
15
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
10
15