繁体   English   中英

在Ubuntu 12.04上通过pip安装matplotlib

[英]Installing matplotlib via pip on Ubuntu 12.04

我正在尝试在Ubuntu 12.04上使用matplotlib。 因此,我用点子制作了一个轮子:

python .local / bin / pip wheel --wheel-dir = wheel / --build = build / matplotlib

然后成功安装它:

python .local / bin / pip install --user --no-index --find-links = wheel / --build = build / matplotlib

但是当我尝试在ipython中导入它时,发生ImportError:

在[1]中:import matplotlib

在[2]中:matplotlib.get_backend()
出[2]:u'agg'

在[3]中:import matplotlib.pyplot

ImportError
追溯(最近一次通话)/ place / home / yefremat / in()----> 1 import matplotlib.pyplot

/home/yefremat/.local/lib/python2.7/site-packages/matplotlib/pyplot.py in()32从matplotlib导入docstring 33从matplotlib.backend_bases导入FigureCanvasBase ---> 34从matplotlib.figure导入图,来自matplotlib.gridspec的figaspect 35从matplotlib.image导入的GridSpec 36读为_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从matplotlib.blocking_input导入BlockingMouseInput,BlockingKeyMouseInput 42从matplotlib.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从matplotlib导入docstring 9导入matplotlib.artist作为martist ---> 10从matplotlib.axes导入。 _axes导入轴11 12导入警告

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

/home/yefremat/.local/lib/python2.7/site-packages/matplotlib/tri/ init .py in()7导入六个8 ----> 9从.triangulation导入* 10从.tricontour导入* 11来自.tritools import *

/home/yefremat/.local/lib/python2.7/site-packages/matplotlib/tri/triangulation.py in()4导入六个5 ----> 6导入matplotlib._tri为_tri 7导入matplotlib._qhull为_qhull 8将numpy导入为np

ImportError:/home/yefremat/.local/lib/python2.7/site-packages/matplotlib/_tri.so:未定义符号:_ZNSt8__detail15_List_node_base9_M_unhookEv

可能是我做错了什么吗? 还是有办法关闭对matplotlib的gui支持?

提前致谢。

好的,问题出在gcc版本中。 在构建和创建软件包包的过程中,pip使用系统gcc(版本为4.7.2)。 我正在使用来自virtualenv的python,它是由gcc 4.4.3构建的。 因此,libstdc ++库的版本在IPython中与pip使用的库不同。

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

谢谢你们。

暂无
暂无

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

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