2013年8月15日木曜日

CentOSにソースからPython3インストールしたんだけど tkinterがimport errorで実行できなかった

 CentOS6.4にてPython3をインストール後
tkinter使ったプログラムを実行しようとしたらインポートエラーの前にpython3がない。
CentOSのデフォルトのリポジトリにpython3がないんですね。
というわけでソース落としてインストールしたけどtkinterでこける。
python3がないのでpython3-tkもないわけですね。

そもそもtk/tclの共有ライブラリをpythonからなんたらしてるのかな?
っていうわけでそもそものそのライブラリがねーんじゃねーのかと思われ
tkとかtclとかのそれっぽいものを適当に入れてしまって、makeしなおしたらいけたってわけさ。ついでにSSLでもこけたので同じようにしただけさ。


あとは眠いんで羅列


File "/usr/local/lib/python3.3/tkinter/__init__.py", line40, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
If it fails with "No module named _tkinter", your Python configuration needs to be modified to include this module (which is an extension module implemented in C). Do **not** edit Modules/Setup (it is out of date). You may have to install Tcl and Tk (when using RPM, install the -devel RPMs as well) and/or edit the setup.py script to point to the right locations where Tcl/Tk is installed. If you install Tcl/Tk in the default locations, simply rerunning "make" should build the _tkinter extension.

yum search tk
でそれっぽいの探してインストールした。
yum install tk tcl tk-devel
たぶんこの辺だと思われる。


  File "/usr/local/lib/python3.3/ssl.py", line 60, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: No module named '_ssl'

yum install openssl openssl-devel

./configure
make
make install