简体   繁体   English

从matplotlib.animation导入FuncAnimation时出错

[英]Get error when importing FuncAnimation from matplotlib.animation

I can't import FuncAnimation from matplotlib.animation. 我无法从matplotlib.animation导入FuncAnimation。 When I try to do it I get the error : 当我尝试这样做时,出现错误:

ValueError: insecure string pickle ValueError:不安全的字符串泡菜

I use matplotlib 1.5.1, Python 2.7, Mac OSX 10.11.3 , in Jupyter Notebook. 我在Jupyter Notebook中使用matplotlib 1.5.1,Python 2.7,Mac OSX 10.11.3。

Ah, I found the problem (for my install): 啊,我发现了问题(对于我的安装):

brew install imagemagick

I dug into the errors python was showing ... 我挖了python显示的错误...

$ python -c "import matplotlib.animation" 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/matplotlib/animation.py", line 578, in <module>
    class ImageMagickWriter(MovieWriter, ImageMagickBase):
  File "/usr/local/lib/python2.7/site-packages/matplotlib/animation.py", line 74, in wrapper
    if writerClass.isAvailable():
  File "/usr/local/lib/python2.7/site-packages/matplotlib/animation.py", line 277, in isAvailable
    creationflags=subprocess_creation_flags)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1334, in _execute_child
    child_exception = pickle.loads(data)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1388, in loads
    return Unpickler(file).load()
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 864, in load
    dispatch[key](self)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 972, in load_string
    raise ValueError, "insecure string pickle"
ValueError: insecure string pickle
$

And noticed ImageMagick was being used. 并注意到正在使用ImageMagick。 Given the comments in this thread ... https://github.com/matplotlib/matplotlib/issues/5314#issuecomment-225368342 ... about missing dependencies, I installed ImageMagick and the issue went away. 给定该线程中的注释... https://github.com/matplotlib/matplotlib/issues/5314#issuecomment-225368342 ...关于缺少依赖项,我安装了ImageMagick,问题消失了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM