2

我在 Mac 上安装了 matplotlib,它是成功的。我输入后

import matplotlib.pyplot as plt

在我的代码中,我收到以下错误:

Traceback (most recent call last):
File "q2.py", line 5, in <module>
import matplotlib.pyplot as plt
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.8-intel.egg/matplotlib/pyplot.py", line 26, in <module>
import matplotlib.colorbar
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.8-intel.egg/matplotlib/colorbar.py", line 31, in <module>
import matplotlib.artist as martist
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.8-intel.egg/matplotlib/artist.py", line 10, in <module>
from .transforms import Bbox, IdentityTransform, TransformedBbox, \
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.8-intel.egg/matplotlib/transforms.py", line 38, in <module>
from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.8-intel.egg/matplotlib/_path.so, 2): Symbol not found: ___emutls_get_address
Referenced from: /usr/local/lib/libstdc++.6.dylib
Expected in: /usr/local/lib/libgcc_s.1.dylib
in /usr/local/lib/libstdc++.6.dylib

我按照以下链接中的安装说明进行操作:

https://github.com/matplotlib/matplotlib/blob/master/README.osx

安装没有问题。有谁知道为什么会发生这种情况?

谢谢!

4

1 回答 1

1

我知道这个问题有点陈旧,但我最近遇到了同样的问题,在网上找不到解决方案。我想我的调试可能会帮助其他人......

显然与 /usr/ local /lib/中的 libgcc_s.1.dylib 和 libstdc++.6.dylib 库不兼容。我备份了这些文件,然后从 /usr/lib/ 中找到的文件进行 sym 链接

sudo mv /usr/local/lib/libgcc_s.1.dylib /usr/local/lib/libgcc_s.1.dylib.old
sudo mv /usr/local/lib/libstdc++.6.dylib /usr/local/lib/libstdc++.6.dylib.old

sudo ln -s /usr/lib/libgcc_s.1.dylib /usr/local/lib/libgcc_s.1.dylib
sudo ln -s /usr/lib/libstdc++.6.dylib /usr/local/lib/libstdc++.6.dylib

我现在可以导入 pyplot :)

于 2014-02-03T20:46:20.740 回答