macOS 上的 psutil 错误
psutil error on macos
def showMemTime(when='Resources'):
global maxmem
# memory and time measurement
process = psutil.Process(os.getpid())
mem = process.get_memory_info()[0] / float(2 ** 20)
maxmem = max(maxmem, mem)
ts = process.get_cpu_times()
sys.stderr.write("{when:<20}: {mb:4.0f} MB (max {maxmb:4.0f} MB), {user:4.1f} s user, {system:4.1f} s system\n".format(
when=when, mb=mem, maxmb=maxmem, user=ts.user, system=ts.system))
我正在尝试使用上面的代码。但是我得到 "AttributeError: 'Process' object has no attribute 'get_memory_info'" 我在 Python 2.7、psutil 5.0.0 和 macOS Sierra
谢谢。
进程 class 没有名为 get_memory_info
的方法。它有 memory_full_info()
和 memory_info()
psutil.Process
metmirr 的附加信息已从 macos 中删除,这可能就是为什么人们仍然 运行 喜欢它的原因。
Changed in version 5.6.0: removed macOS support because inherently
broken (see issue #1291)
def showMemTime(when='Resources'):
global maxmem
# memory and time measurement
process = psutil.Process(os.getpid())
mem = process.get_memory_info()[0] / float(2 ** 20)
maxmem = max(maxmem, mem)
ts = process.get_cpu_times()
sys.stderr.write("{when:<20}: {mb:4.0f} MB (max {maxmb:4.0f} MB), {user:4.1f} s user, {system:4.1f} s system\n".format(
when=when, mb=mem, maxmb=maxmem, user=ts.user, system=ts.system))
我正在尝试使用上面的代码。但是我得到 "AttributeError: 'Process' object has no attribute 'get_memory_info'" 我在 Python 2.7、psutil 5.0.0 和 macOS Sierra
谢谢。
进程 class 没有名为 get_memory_info
的方法。它有 memory_full_info()
和 memory_info()
psutil.Process
metmirr 的附加信息已从 macos 中删除,这可能就是为什么人们仍然 运行 喜欢它的原因。
Changed in version 5.6.0: removed macOS support because inherently broken (see issue #1291)