我正在尝试在 OS X 上安装和使用 apptrace 以调试 GAE 内存......这很复杂,我仍然没有设法安装它。
文档说这是最简单的安装方法:
easy_install apptrace
但为了让它工作,我必须安装一堆依赖项,如 ActiveState、Guppy 以及可能更多......
后来经历了很多试验和错误,我想我已经走了很远,但仍然没有。所以我这样做是为了尝试重新安装 apptrace,然后安装它以捕获过程中的所有错误:
$ sudo pip uninstall apptrace
Uninstalling apptrace:
/Library/Frameworks/Python.framework/Versions/2.7/bin/apptracectl
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/apptrace-0.2.3-py2.7.egg
Proceed (y/n)? y
Successfully uninstalled apptrace
然后安装
$ sudo easy_install apptrace
Searching for apptrace
Reading https://pypi.python.org/simple/apptrace/
Reading http://code.google.com/p/apptrace
Best match: apptrace 0.2.3
Downloading https://pypi.python.org/packages/source/a/apptrace/apptrace-0.2.3.tar.gz#md5=ed03efe7afd70584a4bd461f429bdb75
Processing apptrace-0.2.3.tar.gz
Writing /tmp/easy_install-xi0K_4/apptrace-0.2.3/setup.cfg
Running apptrace-0.2.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-xi0K_4/apptrace-0.2.3/egg-dist-tmp-zhij3l
Adding apptrace 0.2.3 to easy-install.pth file
Installing apptracectl script to /Library/Frameworks/Python.framework/Versions/2.7/bin
Installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/apptrace-0.2.3-py2.7.egg
Processing dependencies for apptrace
Finished processing dependencies for apptrace
看起来没有发生任何错误对吧?
然后文档建议在应用程序根目录中创建一个 appengine_config.py 文件,其中包含:
def webapp_add_wsgi_middleware(app):
from apptrace.middleware import apptrace_middleware
return apptrace_middleware(app)
完成后,下一个必需的步骤是:
apptracectl init <application root directory>
这会发生:
Traceback (most recent call last):
File "/usr/local/bin/apptracectl", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: apptrace==0.2.3
所以这里的错误是pkg_resources.DistributionNotFound: apptrace==0.2.3
我该怎么办?