iPythonが正しく動いていない。
iPythonを起動すると、以下のような警告が出て入力履歴や自動インデントが機能しません。
WARNING: IPython History requires SQLite, your history will not be saved
WARNING: Readline services not available or not loaded.
WARNING: The auto-indent feature requires the readline library
原因を調べてみる。
Pythonをコンパイルしたときのmekeログを確認してみると、以下のようなメッセージが出ていました。
原因は、依存しているライブラリが無いためのようです。
Python2.7では以下の内容でした。
Python build finished, but the necessary bits to build these modules were not found:
_bsddb _curses _curses_panel
_sqlite3 _ssl _tkinter
bsddb185 bz2 dbm
dl gdbm imageop
readline sunaudiodev zlib
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
Python3.4では、こんな感じでした。
The necessary bits to build these optional modules were not found:
_bz2 _curses _curses_panel
_dbm _gdbm _lzma
_sqlite3 _ssl _tkinter
readline zlib
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
ライブラリをインストールする。
さっそく必要なライブラリをインストールして、Pythonを再コンパイルしましょう。
(xz-develは、Python3.xでのみ必要です。それ以外は、2.xと3.xの両方で必要です。)
yum install ncurses-devel
yum install sqlite-devel
yum install openssl-devel
yum install tk-devel
yum install bzip2-devel
yum install gdbm-devel
yum install readline-devel
yum install xz-devel
以下は、インストールしません。(簡単な理由と、参考にしたURLを書いておきます)
_bsddb
https://docs.python.org/2/library/bsddb.html
Deprecated since version 2.6: The bsddb module has been removed in Python 3.
バージョン2.6以降で非奨励
bsddb185
https://docs.python.org/2/library/undoc.html
It is normally only available on certain BSD Unix-based systems.
通常は特定のBSD Unixでのみ利用可能。(今回はCentOSにインストールしているため使用しません)
dl
https://docs.python.org/2/library/dl.html?highlight=dl#module-dl
Deprecated since version 2.6: The dl module has been removed in Python 3. Use the ctypes module instead.
バージョン2.6以降で非奨励
imageop
https://docs.python.org/2/library/imageop.html
Deprecated since version 2.6: The imageop module has been removed in Python 3.
バージョン2.6以降で非奨励
sunaudiodev
https://docs.python.org/2/library/sunaudio.html
Deprecated since version 2.6: The sunaudiodev module has been removed in Python 3.
バージョン2.6以降で非奨励
makeログを確認する。
Pythonをコンパイルするとmakeログは以下の内容でした。
Python2.7では、こんな感じです。
インストールせずに放置したモジュールだけが残っています。
Python build finished, but the necessary bits to build these modules were not found:
_bsddb bsddb185 dl
imageop sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
Python3.4では、不足モジュールは無くなりました。
iPythonが正常に動きます。
Python2.7で起動。例の警告が消えています。
入力履歴や自動インデントも正しく機能しています。
これで、快適にPythonできますね。
お疲れ様でした。