我对python和OSX都很陌生,所以如果我不理解超级基本的东西,请原谅我。
我在Homebrew的全新安装中使用python 2.7.12。我还使用Homebrew来安装ipython,ffmpeg和libav(安装avconv,我认为这是我尝试做的事情所必需的。)
背景(针对某些情况): 我正在运行一些流体动力学模拟,输出一堆二进制文件。我不想把它们拼接在一起制作一部电影。幸运的是,我的一位同事已经编写了一个整洁的小蟒蛇脚本(他在ipython中写道)。
问题: 试图运行时
import matplotlib.animation
脚本挂起,matplotlib动画永远不会被导入。我尝试通过
更改后端import matplotlib
matplotlib.use('tkagg')
import matplotlib.animaton
我通过运行List of all available matplotlib backends
中的代码尝试了各种后端我也试过import matplotlib.pyplot hangs(更新fc-lists)
最后,我不确定这是否有用,但让ipython尝试导入matplot.animation大约10分钟,然后终止它输出以下内容
In [3]: import matplotlib.animation
^C---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
<ipython-input-3-64e90e455a86> in <module>()
----> 1 import matplotlib.animation
/usr/local/lib/python2.7/site-packages/matplotlib/animation.py in <module>()
589
590 @writers.register('imagemagick')
--> 591 class ImageMagickWriter(MovieWriter, ImageMagickBase):
592 def _args(self):
593 return ([self.bin_path(),
/usr/local/lib/python2.7/site-packages/matplotlib/animation.py in wrapper(writerClass)
73 def register(self, name):
74 def wrapper(writerClass):
---> 75 if writerClass.isAvailable():
76 self.avail[name] = writerClass
77 return writerClass
/usr/local/lib/python2.7/site-packages/matplotlib/animation.py in isAvailable(cls)
284 stderr=subprocess.PIPE,
285 creationflags=subprocess_creation_flags)
--> 286 p.communicate()
287 return True
288 except OSError:
/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/ lib/python2.7/subprocess.pyc in communicate(self, input)
798 return (stdout, stderr)
799
--> 800 return self._communicate(input)
801
802
/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.pyc in _communicate(self, input)
1417 stdout, stderr = self._communicate_with_poll(input)
1418 else:
-> 1419 stdout, stderr = self._communicate_with_select(input)
1420
1421 # All data exchanged. Translate lists into strings.
/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.pyc in _communicate_with_select(self, input)
1518 while read_set or write_set:
1519 try:
-> 1520 rlist, wlist, xlist = select.select(read_set, write_set, [])
1521 except select.error, e:
1522 if e.args[0] == errno.EINTR:
KeyboardInterrupt:
如果您再考虑一下,即使您无法提供帮助,也要非常感谢!
答案 0 :(得分:0)
您是否安装了多个版本的Python?我会检查你的python路径。在这种情况下,确保matplotlib在2.7中。
这也可能相关 - import matplotlib.pyplot hangs