You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

JSBGym调用render()时出现ArtistList无pop()方法的属性错误

解决JSBGym中env.render()触发的AttributeError问题

问题根源

matplotlib版本更新后,subplot.lines返回的对象从普通列表变为ArtistList,而ArtistList不支持pop()方法,导致原代码的subplot.lines.pop()触发报错。

修复步骤

  1. 打开项目内的jsbgym/visualiser.py文件,定位到第64行的subplot.lines.pop()代码。
  2. 将这行代码替换为以下任意一种写法:
    • 写法一(推荐):用del语句按索引删除最后一个元素
      del subplot.lines[-1]
      
    • 写法二:先转为普通列表再执行pop操作
      lines_list = list(subplot.lines)
      lines_list.pop()
      
  3. 保存文件后重新运行代码,env.render()即可正常工作。

内容的提问来源于stack exchange,提问作者sryu1

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.29 01:27:10