相关疑难解决方法(0)

无法在Python 3中导入cProfile

我试图将cProfile模块导入Python 3.3.0,但我收到以下错误:

Traceback (most recent call last):
  File "<pyshell#7>", line 1, in <module>
    import cProfile
  File "/.../cProfile_try.py", line 12, in <module>
    help(cProfile.run)
AttributeError: 'module' object has no attribute 'run'
Run Code Online (Sandbox Code Playgroud)

完整的代码(cProfile_try.py)如下

import cProfile
help(cProfile.run)

L = list(range(10000000))
len(L)
# 10000000

def binary_search(L, v):
    """ (list, object) -> int

    Precondition: L is sorted from smallest to largest, and
    all the items in L can be compared to v.

    Return the index of the first occurrence of v in L, or …
Run Code Online (Sandbox Code Playgroud)

python cprofile

13
推荐指数
1
解决办法
4284
查看次数

标签 统计

cprofile ×1

python ×1