如何在python 2.7下安装heapy?

时间:2011-07-19 16:22:51

标签: python memory-management memory-leaks

似乎最新版本仅适用于2.6。

我正面临ImportError: DLL load failed: The specified module could not be found.并且无法找到任何解决方案,有人知道吗?

是否有其他内存分析器可用于python 2.7?

错误追溯:

>>> import guppy
>>> from guppy import hpy
>>> h = hpy()

Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    h = hpy()
  File "D:\program files\Python2.7\lib\site-packages\guppy\__init__.py", line 37, in hpy
    return r.guppy.heapy.Use
  File "D:\program files\Python2.7\lib\site-packages\guppy\etc\Glue.py", line 45, in __getattr__
    return self._share.getattr(self, name)
  File "D:\program files\Python2.7\lib\site-packages\guppy\etc\Glue.py", line 195, in getattr
    d = self.getattr2(inter, cache, owner, name)
  File "D:\program files\Python2.7\lib\site-packages\guppy\etc\Glue.py", line 213, in getattr2
    x = self.getattr_package(inter, name)
  File "D:\program files\Python2.7\lib\site-packages\guppy\etc\Glue.py", line 261, in getattr_package
    x = self.makeModule(x, name)
  File "D:\program files\Python2.7\lib\site-packages\guppy\etc\Glue.py", line 321, in makeModule
    return Share(module, self, module.__name__, Clamp)
  File "D:\program files\Python2.7\lib\site-packages\guppy\etc\Glue.py", line 184, in __init__
    getattr(inter, name)
  File "D:\program files\Python2.7\lib\site-packages\guppy\etc\Glue.py", line 45, in __getattr__
    return self._share.getattr(self, name)
  File "D:\program files\Python2.7\lib\site-packages\guppy\etc\Glue.py", line 195, in getattr
    d = self.getattr2(inter, cache, owner, name)
  File "D:\program files\Python2.7\lib\site-packages\guppy\etc\Glue.py", line 215, in getattr2
    x = self.getattr3(inter, name)
  File "D:\program files\Python2.7\lib\site-packages\guppy\etc\Glue.py", line 283, in getattr3
    pa = getattr(pa, at)
  File "D:\program files\Python2.7\lib\site-packages\guppy\etc\Glue.py", line 45, in __getattr__
    return self._share.getattr(self, name)
  File "D:\program files\Python2.7\lib\site-packages\guppy\etc\Glue.py", line 195, in getattr
    d = self.getattr2(inter, cache, owner, name)
  File "D:\program files\Python2.7\lib\site-packages\guppy\etc\Glue.py", line 213, in getattr2
    x = self.getattr_package(inter, name)
  File "D:\program files\Python2.7\lib\site-packages\guppy\etc\Glue.py", line 250, in getattr_package
    x = __import__(self.makeName(name), globals(), locals())
  File "D:\program files\Python2.7\lib\site-packages\guppy\heapy\View.py", line 555, in <module>
    prime_builtin_types()
  File "D:\program files\Python2.7\lib\site-packages\guppy\heapy\View.py", line 538, in prime_builtin_types
    import guppy.heapy.heapyc
ImportError: DLL load failed: The specified module could not be found.

3 个答案:

答案 0 :(得分:15)

当我尝试从guppy源文件所在的文件夹启动python时,我遇到了同样的错误。但是在这个目录中我遇到了实例化hpy的问题。最后,我通过从trunk

安装来解决python2.7问题
pip install https://guppy-pe.svn.sourceforge.net/svnroot/guppy-pe/trunk/guppy

答案 1 :(得分:0)

看起来目录中可能只缺少所需的dll - 您可以尝试将其从2.6目录复制到相应的路径中。但不保证。

答案 2 :(得分:0)

  1. https://pypi.python.org/pypi/guppy/0.1.10(或您需要的任何版本)下载源代码
  2. 解压tar文件:tar zxf [你的guppy tar文件]
  3. 进入文件夹:cd guppy- [version]
  4. 请注意setup.py文件。运行setup:sudo python setup.py install
  5. 安装了Guppy。