次の記事を見つけました: Timing and Profiling in IPython from March, 2013 ですが、マジックの定義と使用に問題があります。これは、記事の情報の一部がもはや当てはまらないためなのだろうか.
やった:
$ pip install line-profiler
$ pip install psutil
$ pip install memory_profiler
そして、IPython セッションで次のように定義しました。
import memory_profiler
def load_ipython_extension(ip):
ip.define_magic('memit', memory_profiler.magic_memit)
ip.define_magic('mprun', memory_profiler.magic_mprun)
私が試したとき:
%memit
私は得る: ERROR: Line magic function not defined
. なんで?
また、2013年の記事はまだIPython 2.xに関連していますか?