python(matplotlib)__NSAutoreleaseNoPool错误...-只是泄漏 [英] python (matplotlib) __NSAutoreleaseNoPool error ... - just leaking

查看:95
本文介绍了python(matplotlib)__NSAutoreleaseNoPool错误...-只是泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[我最初将此内容发布在serverfault中,但建议在那里将其发布在此处.]

[I originally posted this in serverfault, but was advised there to post it here instead.]

Matplotlib是用于数据可视化的python库.当我尝试在屏幕上显示图形时,出现以下错误/警告:

Matplotlib is a python library for data visualization. When I attempt to display a graph on the screen, I get the following error/warnings:

2012-12-21 16:40:05.532 python[9705:903] *** __NSAutoreleaseNoPool(): Object 0x103e25d80 of class NSCFArray autoreleased with no pool in place - just leaking
2012-12-21 16:40:05.534 python[9705:903] *** __NSAutoreleaseNoPool(): Object 0x103e26820 of class __NSFastEnumerationEnumerator autoreleased with no pool in place - just leaking
2012-12-21 16:40:05.535 python[9705:903] *** __NSAutoreleaseNoPool(): Object 0x103e9f080 of class NSObject autoreleased with no pool in place - just leaking

FWIW,产生这些结果的一种方法如下所示;显示的所有步骤(包括对ipython的调用)均来自matplotlib教程:

FWIW, one way to produce these results is shown below; all the steps shown (including the call to ipython) are taken from a matplotlib tutorial:

% ipython
...
In [1]: import matplotlib.pyplot as plt

In [2]: plt.plot([1, 3, 2, 4])
Out[3]: [<matplotlib.lines.Line2D at 0x106aabd90>]

In [3]: plt.show()

此外,FWIW,我观察到python + numpy + matplotlib + ipython的多种安装方式(在同一台计算机上)完全相同的行为,包括使用系统提供的安装python,使用homebrew安装的python或使用直接从源代码安装到我主目录之外位置的python.

ALso, FWIW, I've observed exactly the same behavior with multiple styles of installation (on the same machine) of python+numpy+matplotlib+ipython, including installs that use the system-supplied python, those that use the python installed by homebrew, or those that use a python installed directly from source into a location off my home directory.

关于可能发生的事情或我能做些什么的任何想法?

Any ideas of what may be going on, or what I could do about it?

推荐答案

我遇到了同样的问题,发现的一种解决方案是添加以下行:

I am having the same problem, one solution I found is to add the line:

plt.ion()

在第一个绘图命令之前.这将打开交互式绘图模式,并且错误消息消失.这只对我有用,当在命令行上绘制时,如果我先执行ion()然后在脚本中执行show(),则这些图根本不会显示,而如果我将ion()留在外面,则可以看到我的情节,但我得到了错误消息.自从更新到1.2.0版以来,这种情况才发生.

before the first plotting command. This turns on the interactive plotting mode and the error messages go away. This has only worked for me when plotting on the command line, if I do ion() and then show() in a script the plots don't show up at all, and if I leave the ion() out, I can see my plots, but I get the error messages. This has only happened since updated to version 1.2.0.

这篇关于python(matplotlib)__NSAutoreleaseNoPool错误...-只是泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆