首页 > 代码库 > 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 报错