2014-09-02 49 views
0

我想在Ubuntu 12.04上使用matplotlib。所以我建立与PIP轮:在Ubuntu 12.04上通过pip安装matplotlib 12.04

蟒蛇。本地/斌/ PIP轮--wheel-DIR =轮/ --build =编译/ matplotlib

然后安装成功:

蟒蛇。本地/斌/ PIP安装--user --no指数--find链接=轮/ --build =编译/ matplotlib

但是,当我试图将其导入IPython中导入错误occures :

In [1]: import matplotlib

In [2]: matplotlib.get_backend()
Out[2]: u'agg'

In [3]: import matplotlib.pyplot

ImportError
Traceback (most recent call last) /place/home/yefremat/ in () ----> 1 import matplotlib.pyplot

/home/yefremat/.local/lib/python2.7/site-packages/matplotlib/pyplot.py in() 32 from matplotlib import docstring 33 from matplotlib.backend_bases import FigureCanvasBase ---> 34 from matplotlib.figure import Figure, figaspect 35 from matplotlib.gridspec import GridSpec 36 from matplotlib.image import imread as _imread

/home/yefremat/.local/lib/python2.7/site-packages/matplotlib/figure.py in() 38 import matplotlib.colorbar as cbar 39 ---> 40 from matplotlib.axes import Axes, SubplotBase, subplot_class_factory 41 from matplotlib.blocking_input import BlockingMouseInput, BlockingKeyMouseInput 42 from matplotlib.legend import Legend

/home/yefremat/.local/lib/python2.7/site-packages/matplotlib/axes/init.py in() 2 unicode_literals) 3 ----> 4 from ._subplots import * 5 from ._axes import *

/home/yefremat/.local/lib/python2.7/site-packages/matplotlib/axes/_subplots.py in() 8 from matplotlib import docstring 9 import matplotlib.artist as martist ---> 10 from matplotlib.axes._axes import Axes 11 12 import warnings

/home/yefremat/.local/lib/python2.7/site-packages/matplotlib/axes/_axes.py in() 36 import matplotlib.ticker as mticker 37 import matplotlib.transforms as mtransforms ---> 38 import matplotlib.tri as mtri 39 import matplotlib.transforms as mtrans 40 from matplotlib.container import BarContainer, ErrorbarContainer, StemContainer

/home/yefremat/.local/lib/python2.7/site-packages/matplotlib/tri/init.py in() 7 import six 8 ----> 9 from .triangulation import * 10 from .tricontour import * 11 from .tritools import *

/home/yefremat/.local/lib/python2.7/site-packages/matplotlib/tri/triangulation.py in() 4 import six 5 ----> 6 import matplotlib._tri as _tri 7 import matplotlib._qhull as _qhull 8 import numpy as np

ImportError: /home/yefremat/.local/lib/python2.7/site-packages/matplotlib/_tri.so: undefined symbol: _ZNSt8__detail15_List_node_base9_M_unhookEv

可能是我在做一些错误吗?或者可能有一种方法可以关闭对matplotlib的gui支持?

在此先感谢。

+0

是不是有没有安装包管理器'sudo apt-get install python-matplotlib'的原因? – rhodysurf 2014-09-02 17:45:15

+0

感谢您的关注,但是。我在随机机器上使用这个软件包,然后清理所有环境。所以,我需要重新安装这个软件包。这就是为什么我决定使用python wheel来加速这个过程。 @rhodysurf – 2014-09-03 09:37:43

回答

0

好的,问题出现在gcc版本中。在构建和创建包pip的轮子期间使用系统gcc(其版本是4.7.2)。我从virtualenv使用python,它是用gcc 4.4.3构建的。所以libstdC++库的版本在IPython和pip使用的版本中是不同的。

与往常一样,有两种解决方案(甚至更多):在输入IPython之前将LD_PRELOAD环境变量与正确的libstdC++一起传递,或者在创建wheel和构建virtualenv时使用相同版本的gcc。我预备了最后一个。

谢谢大家。