1. 程式人生 > >ipython 運行 %lprun 報錯

ipython 運行 %lprun 報錯

ipython 運行 %lprun 報錯

環境描述:

1.win7 x64

2.python 2.7 32

3.ipython 5.2.2

問題描述:

In [9]: %lprun
ERROR:root:Line magic function `%lprun` not found.

解決步驟:

1.安裝line_profiler

下載地址:https://pypi.python.org/pypi/line_profiler/2.0

安裝:python setup.py install

2.修改ipython 配置文件

C:\Users\hunk206\.ipython>ipython profile create
[ProfileCreate] Generating default config file: u‘C:\\Users\\hunk206\\.ipython\\
profile_default\\ipython_config.py‘

在文件ipython_config.py 中添加 c.TerminalIPythonApp.extensions = [‘line_profiler‘]

3.

In [1]: %lprun
Timer unit: 3.42177e-07 s


ipython 運行 %lprun 報錯