以下の内容はhttps://nakamura001.hatenablog.com/entry/20101213/1292206774より取得しました。


「If this fails your Python may not be configured for Tk」というエラーが発生

Pythonで久しぶりにTkinterを使ったところ import Tkinter の所で以下のエラーが発生しました。

Traceback (most recent call last):
  File "main.py", line 8, in <module>
    import Tkinter
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk/Tkinter.py", line 39, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk

MacPortsでのインストール状況をチェックする為に以下のコマンドを実行。

port installed | grep python
  python24 @2.4.6_7 (active)
  python25 @2.5.5_0+darwin+darwin_10+macosx
  python25 @2.5.5_1 (active)
  python26 @2.6.4_0+darwin
  python26 @2.6.6_0+no_tkinter (active)
  xorg-libxcb @1.7_0+python26 (active)
  xorg-xcb-proto @1.6_0+python26 (active)

python26 @2.6.6_0+no_tkinter の所がいかにも怪しいですね。なんで +no_tkinter なんてついてるんでしょ?そりゃ、エラーとなりますね。

色々と試した所、MacPortでPygameをインストールすると +no_tkinter 付きのPythonがActiveになるみたいでした。




以上の内容はhttps://nakamura001.hatenablog.com/entry/20101213/1292206774より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14