简体   繁体   English

iPython lprun不打印输出

[英]iPython lprun not printing output

I don't know what's going on here, so thought I would ask you guys. 我不知道这里发生了什么,所以以为我会问你们。

I just installed iPython 3.1 on Mac OSX 10.10.2 我刚刚在Mac OSX 10.10.2上安装了iPython 3.1

In iPython I tried my function with no results, but here is an example: 在iPython中,我尝试了没有结果的函数,但这是一个示例:

In [21]: def rn():
   ....:     for ix in range(0,100): print ix
   ....:

In [22]: %lprun rn()
0
1
2
3
4
....
98
99
Timer unit: 1e-06 s

In this type of situation I'm expecting a normal cProfile type output, showing the lines that ran and how long each one took. 在这种情况下,我期望输出一个正常的cProfile类型,显示运行的行以及每个行花费的时间。 What am I doing wrong?! 我究竟做错了什么?!

Thanks! 谢谢!

Use the -f flag to get line by line output: 使用-f标志获取逐行输出:

%lprun -f rn  rn()

Output: 输出:

In [13]: %lprun -f rn  rn()
0
1
2
3
4
5
...
94
95
96
97
98
99
Timer unit: 1e-06 s

Total time: 0.000933 s
File: <ipython-input-4-00cddd5336b9>
Function: rn at line 1

Line #      Hits         Time  Per Hit   % Time  Line Contents
==============================================================
     1                                           def rn():
     2       101          933      9.2    100.0        for ix in range(0,100): print ix

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM