如何在Python 2.7下安装heapy?

13 投票
3 回答
6707 浏览
提问于 2025-04-16 21:51

看起来最新版本只支持2.6。

我遇到了一个错误:ImportError: DLL load failed: 找不到指定的模块。,我找不到任何解决办法,有人知道该怎么处理吗?

有没有其他适用于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
  1. 从这个链接下载源代码:https://pypi.python.org/pypi/guppy/0.1.10(或者你需要的其他版本)
  2. 解压这个tar文件:输入命令 tar zxf [你的 guppy tar 文件]
  3. 进入解压后的文件夹:输入命令 cd guppy-[版本]
  4. 注意到有一个叫 setup.py 的文件。运行安装命令:输入 sudo python setup.py install

Guppy 安装完成。

0

看起来可能是缺少了需要的dll文件,你可以试着从2.6版本的文件夹里复制一个到正确的位置。不过,这样做不一定能解决问题。

15

我在尝试从存放guppy源文件的文件夹启动python时遇到了同样的错误。但是在这个目录之外,我在创建hpy的时候遇到了问题。最后,我通过从主干安装,成功让heapy在python2.7上运行了。

pip install https://guppy-pe.svn.sourceforge.net/svnroot/guppy-pe/trunk/guppy

撰写回答