致命的 Python 错误:已跟踪 GC 对象 [英] Fatal Python error: GC object already tracked

查看:24
本文介绍了致命的 Python 错误:已跟踪 GC 对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 matplotlib 创建一些图表,使用 AGG 后端.

I use matplotlib to create some charts, using the AGG backend.

import matplotlib
matplotlib.use('AGG')
import matplotlib.plot as plt

# ...

def chart_view(request):
    fig = plt.figure
    # Do stuff with fig and finally save it in a Django HttpResponse
    # object and return the HttpResponse object.

现在我有一个包含三个图像的网页,所有三个图像都导致运行 chart_view.通常只有一张图片,Django 开发服务器停止并显示致命的 Python 错误:GC 对象已经跟踪".我不确定问题出在 matplotlib 中,它可能出在 pandas 中.

Now I have a web page that has three images, all three images resulting in running chart_view. Only one image usually makes it, and the Django development server stops with "Fatal Python error: GC object already tracked". I'm not certain the problem is in matplotlib, it could be in pandas.

如何调试问题?

推荐答案

好的,我发现当我将 Debian Jessie 的 matplotlib 1.4.2 与我安装的最新 pandas (0.17.0) 结合使用时,它会这样做使用 pip install --upgrade --no-deps pandas(在使用 --system-site-packages 的 virtualenv 中).如果我使用 Debian 的 pandas 0.14.1 一切都很好.去弄清楚这是为什么.无论如何,我打算使用 Debian 的软件包,这样就解决了我的问题.

OK, I found out that it's doing it when I use Debian Jessie's matplotlib 1.4.2 in combination with the latest pandas (0.17.0) that I have installed with pip install --upgrade --no-deps pandas (in a virtualenv that uses --system-site-packages). If I use Debian's pandas 0.14.1 everything's fine. Go figure why this is. Anyway, using Debian's packages is what I intended to do so this solves the problem for me.

这篇关于致命的 Python 错误:已跟踪 GC 对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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