gpt4 book ai didi

python-2.7 - ipython/pylab/matplotlib安装初始化报错

转载 作者:行者123 更新时间:2023-12-04 21:35:51 25 4
gpt4 key购买 nike

我在 OS X El Captain 上安装了 matplotlib、anaconda、ipython。然而,即使在尝试以所有可能的方式设置环境变量之后,我也无法启动 ipython shell --pylab 版本。

这是错误。

ImportError: dlopen(/Users/apple/anaconda/lib/python2.7/site-packages/matplotlib/_png.so, 2): Library not loaded: @rpath/libpng16.16.dylib
Referenced from: /Users/apple/anaconda/lib/python2.7/site-packages/matplotlib/_png.so
Reason: Incompatible library version: _png.so requires version 40.0.0 or later, but libpng16.16.dylib provides version 39.0.0

最初,在正常的 pip install matplotlib 之后,matplotlib 没有出现。使用从“conda”重新安装 matplotlib 后
conda install -c conda-forge matplotlib=1.5.2,我没有收到导入错误 pf package not found 但 pylab 版本仍然不起作用。我尝试升级 libpng 库,并将其安装在/usr/local 中,但也没有用。不知道_png.so要怎么升级
在/anaconda/site-packages/matplotlib 文件夹中。
我也试过设置 libpng.x.dylib 库的环境变量我不知道为什么它不起作用或者我没有正确完成它。

这是完整的屏幕截图,以防万一:-
IPython 5.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
TerminalIPythonApp WARNING | Eventloop or matplotlib integration failed. Is matplotlib installed?
ImportError                               Traceback (most recent call last)
/Users/apple/anaconda/lib/python2.7/site-packages/IPython/core/shellapp.pyc in <lambda>(key)
196 shell = self.shell
197 if self.pylab:
--> 198 enable = lambda key: shell.enable_pylab(key, import_all=self.pylab_import_all)
199 key = self.pylab
200 elif self.matplotlib:

/Users/apple/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in enable_pylab(self, gui, import_all, welcome_message)
2972 from IPython.core.pylabtools import import_pylab
2973
---> 2974 gui, backend = self.enable_matplotlib(gui)
2975
2976 # We want to prevent the loading of pylab to pollute the user's

/Users/apple/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in enable_matplotlib(self, gui)
2933 gui, backend = pt.find_gui_and_backend(self.pylab_gui_select)
2934
--->2935 pt.activate_matplotlib(backend)
2936 pt.configure_inline_support(self, backend)
2937

/Users/apple/anaconda/lib/python2.7/site-packages/IPython/core/pylabtools.pyc in activate_matplotlib(backend)
293 matplotlib.rcParams['backend'] = backend
294
--> 295 import matplotlib.pyplot
296 matplotlib.pyplot.switch_backend(backend)
297

/Users/apple/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.py in <module>()
27 from cycler import cycler
28 import matplotlib
--->29 import matplotlib.colorbar
30 from matplotlib import style
31 from matplotlib import _pylab_helpers, interactive

/Users/apple/anaconda/lib/python2.7/site-packages/matplotlib/colorbar.py in <module>()
32 import matplotlib.artist as martist
33 import matplotlib.cbook as cbook
---> 34 import matplotlib.collections as collections
35 import matplotlib.colors as colors
36 import matplotlib.contour as contour

/Users/apple/anaconda/lib/python2.7/site-packages/matplotlib/collections.py in <module>()
25 import matplotlib.artist as artist
26 from matplotlib.artist import allow_rasterization
---> 27 import matplotlib.backend_bases as backend_bases
28 import matplotlib.path as mpath
29 from matplotlib import _path

/Users/apple/anaconda/lib/python2.7/site-packages/matplotlib/backend_bases.py in <module>()
60
61 import matplotlib.tight_bbox as tight_bbox
---> 62 import matplotlib.textpath as textpath
63 from matplotlib.path import Path
64 from matplotlib.cbook import mplDeprecation, warn_deprecated

/Users/apple/anaconda/lib/python2.7/site-packages/matplotlib/textpath.py in <module>()
16 from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, LOAD_NO_HINTING
17 from matplotlib.ft2font import LOAD_TARGET_LIGHT
---> 18 from matplotlib.mathtext import MathTextParser
19 import matplotlib.dviread as dviread
20 from matplotlib.font_manager import FontProperties

/Users/apple/anaconda/lib/python2.7/site-packages/matplotlib/mathtext.py in <module>()
58
59 import matplotlib.colors as mcolors
---> 60 import matplotlib._png as _png
61 ####################
62

ImportError: dlopen(/Users/apple/anaconda/lib/python2.7/site-packages/matplotlib/_png.so, 2): Library not loaded: @rpath/libpng16.16.dylib
Referenced from: /Users/apple/anaconda/lib/python2.7/site-packages/matplotlib/_png.so
Reason: Incompatible library version: _png.so requires version 40.0.0 or later, but libpng16.16.dylib provides version 39.0.0

最佳答案

尝试:

brew uninstall libpng
conda uninstall matplotlib
conda install matplotlib

关于python-2.7 - ipython/pylab/matplotlib安装初始化报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38564507/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com