我通过“sudo python setup.py install”从它的 svn#95 安装了 guppy 内存分析器。
它看起来正确安装。
yey@yey:/usr/local/lib/python2.7/dist-packages/guppy/heapy$ ls *.so *.py
AbstractAlgebra.py ImpSet.py Path.py Remote.py Use.py
Classifiers.py __init__.py pbhelp.py RM.py View.py
Console.py Monitor.py Prof.py Spec.py
Doc.py OutputHandling.py RefPat.py Target.py
heapyc.so Part.py RemoteConstants.py UniSet.py
但我仍然无法导入它。Guppy 的 Python 源代码会执行此导入,因此它应该会成功。
>>> import guppy.heapy
>>> import guppy.heapy.heapyc
# trying /usr/local/lib/python2.7/dist-packages/guppy/heapy/heapyc.so
# trying /usr/local/lib/python2.7/dist-packages/guppy/heapy/heapycmodule.so
# trying /usr/local/lib/python2.7/dist-packages/guppy/heapy/heapyc.py
# trying /usr/local/lib/python2.7/dist-packages/guppy/heapy/heapyc.pyc
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named heapyc
我的问题是,Python 显然试图在正确的位置导入文件。为什么失败了?是因为 .so 文件损坏了吗?还是我的 ld.so.cache 不知何故坏了?谢谢!