簡體   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