Macの環境を整理してて古いMacportsを削除したりしたのでipythonをpipでインストールしたら、バージョンが上がってて設定ファイルの互換性がなくなってたのでこっちも整理した話。
インストール
sudo pip ipython
でインストール
readlineがあったほうがいいんだけど、sudo pip readlineだとllvmがどうたらこうたらでインストールできなかったので、
sudo easy_install readline
で入れた
http://stackoverflow.com/questions/6889490/pip-installing-ipython-with-readline-on-osx-lion
もげーpipだとreadlineがllvmのほげほげでインストールできんかったけど、easy_installだとあっさり入ったぽいURL
IPythonが起動したらこんなメッセージ
/Library/Python/2.7/site-packages/IPython/utils/path.py:420: UserWarning: Found old IPython config file u'/Users/shrkw/.ipython/ipy_user_conf.py' (modified by user) warnings.warn("Found old IPython config file %r (modified by user)"%f) /Library/Python/2.7/site-packages/IPython/utils/path.py:420: UserWarning: Found old IPython config file u'/Users/shrkw/.ipython/ipythonrc' (modified by user) warnings.warn("Found old IPython config file %r (modified by user)"%f) /Library/Python/2.7/site-packages/IPython/utils/path.py:432: UserWarning: The IPython configuration system has changed as of 0.11, and these files will be ignored. See http://ipython.github.com/ipython-doc/dev/config for details of the new config system. To start configuring IPython, do `ipython profile create`, and edit `ipython_config.py` in <ipython_dir>/profile_default. If you need to leave the old config files in place for an older version of IPython and want to suppress this warning message, set `c.InteractiveShellApp.ignore_old_config=True` in the new config. `c.InteractiveShellApp.ignore_old_config=True` in the new config.""") Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
ipython profile create
を実行しろというので実行
.ipython/profile_default/ipython_config.py
みたいなファイルを適宜変更。
以前のはテキストファイルだったのでpythonのコードを書くのが面倒だったけど、新しいバージョンのはpyファイルになってるので、凝った設定をするのもラク。
0.11未満は
execute import time execute __cmd = '/Users/shrkw/log/ipython/%s.log rotate' execute __IP.magic_logstart(__cmd % time.strftime('%Y-%m-%d_%H-%M-%S'))
だったのが、0.11以降なら
c.TerminalInteractiveShell.logstart = True import time logfile = '/Users/shrkw/log/ipython/%s.log' % time.strftime('%Y-%m-%d_%H-%M-%S') c.TerminalInteractiveShell.logfile = logfile
でOK。すっきり。