问题描述
我在 matplotlib 1.0.0
上工作 Python 2.5.2
( Ubuntu 10.04
)
请参阅附加的控制台输出。任何想法都赞赏。谢谢
I have a problem getting matplotlib 1.0.0
to work in Python 2.5.2
(Ubuntu 10.04
)See attached console output. Any ideas appreciated. Thanks
Python 2.5.2 (r252:60911, Jul 23 2010, 23:04:44)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import scipy
>>> import matplotlib
>>> print matplotlib.__version__
1.0.0
>>> print numpy.__version__
1.4.1
>>> print scipy.__version__
0.8.0rc3
>>> from pylab import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.5/site-packages/pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "/usr/local/lib/python2.5/site-packages/matplotlib/pylab.py", line 216, in <module>
from matplotlib import mpl # pulls in most modules
File "/usr/local/lib/python2.5/site-packages/matplotlib/mpl.py", line 2, in <module>
from matplotlib import axis
File "/usr/local/lib/python2.5/site-packages/matplotlib/axis.py", line 14, in <module>
import matplotlib.text as mtext
File "/usr/local/lib/python2.5/site-packages/matplotlib/text.py", line 31, in <module>
from matplotlib.backend_bases import RendererBase
File "/usr/local/lib/python2.5/site-packages/matplotlib/backend_bases.py", line 41, in <module>
import matplotlib.textpath as textpath
File "/usr/local/lib/python2.5/site-packages/matplotlib/textpath.py", line 9, in <module>
from matplotlib.mathtext import MathTextParser
File "/usr/local/lib/python2.5/site-packages/matplotlib/mathtext.py", line 52, in <module>
import matplotlib._png as _png
ImportError: libpng14.so.14: cannot open shared object file: No such file or directory
>>>
7月27,01:05
重建matlibplot给出:
July 27,01:05A rebuild of matlibplot gives:
sudo python setup.py build
basedirlist is: ['/usr/local', '/usr']
============================================================================
BUILDING MATPLOTLIB
matplotlib: 1.0.0
python: 2.5.2 (r252:60911, Jul 23 2010, 23:04:44) [GCC
4.4.3]
platform: linux2
REQUIRED DEPENDENCIES
numpy: 1.4.1
freetype2: 11.1.5
OPTIONAL BACKEND DEPENDENCIES
libpng: 1.4.3
Tkinter: no
* TKAgg requires Tkinter
wxPython: no
* wxPython not found
Gtk+: no
* Building for Gtk+ requires pygtk; you must be able
* to "import gtk" in your build/install environment
Mac OS X native: no
Qt: no
Qt4: no
Cairo: no
OPTIONAL DATE/TIMEZONE DEPENDENCIES
datetime: present, version unknown
dateutil: 1.5
pytz: 2010h
OPTIONAL USETEX DEPENDENCIES
dvipng: no
ghostscript: 8.71
latex: no
pdftops: 0.12.4
[Edit setup.cfg to suppress the above messages]
============================================================================
pymods ['pylab']
packages ['matplotlib', 'matplotlib.backends', 'matplotlib.backends.qt4_editor', 'matplotlib.projections', 'matplotlib.testing', 'matplotlib.testing.jpl_units', 'matplotlib.tests', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', 'mpl_toolkits.axes_grid1', 'mpl_toolkits.axisartist', 'matplotlib.sphinxext', 'matplotlib.numerix', 'matplotlib.numerix.mlab', 'matplotlib.numerix.ma', 'matplotlib.numerix.linear_algebra', 'matplotlib.numerix.random_array', 'matplotlib.numerix.fft', 'matplotlib.tri', 'matplotlib.delaunay']
running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc -> build/lib.linux-i686-2.5/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf -> build/lib.linux-i686-2.5/matplotlib/mpl-data
running build_ext
sudo python setup.py install
basedirlist is: ['/usr/local', '/usr']
============================================================================
BUILDING MATPLOTLIB
matplotlib: 1.0.0
python: 2.5.2 (r252:60911, Jul 23 2010, 23:04:44) [GCC
4.4.3]
platform: linux2
REQUIRED DEPENDENCIES
numpy: 1.4.1
freetype2: 11.1.5
OPTIONAL BACKEND DEPENDENCIES
libpng: 1.4.3
Tkinter: no
* TKAgg requires Tkinter
wxPython: no
* wxPython not found
Gtk+: no
* Building for Gtk+ requires pygtk; you must be able
* to "import gtk" in your build/install environment
Mac OS X native: no
Qt: no
Qt4: no
Cairo: no
OPTIONAL DATE/TIMEZONE DEPENDENCIES
datetime: present, version unknown
dateutil: 1.5
pytz: 2010h
OPTIONAL USETEX DEPENDENCIES
dvipng: no
ghostscript: 8.71
latex: no
pdftops: 0.12.4
[Edit setup.cfg to suppress the above messages]
============================================================================
pymods ['pylab']
packages ['matplotlib', 'matplotlib.backends', 'matplotlib.backends.qt4_editor', 'matplotlib.projections', 'matplotlib.testing', 'matplotlib.testing.jpl_units', 'matplotlib.tests', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', 'mpl_toolkits.axes_grid1', 'mpl_toolkits.axisartist', 'matplotlib.sphinxext', 'matplotlib.numerix', 'matplotlib.numerix.mlab', 'matplotlib.numerix.ma', 'matplotlib.numerix.linear_algebra', 'matplotlib.numerix.random_array', 'matplotlib.numerix.fft', 'matplotlib.tri', 'matplotlib.delaunay']
running install
running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc -> build/lib.linux-i686-2.5/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf -> build/lib.linux-i686-2.5/matplotlib/mpl-data
running build_ext
running install_lib
copying build/lib.linux-i686-2.5/matplotlib/mpl-data/matplotlibrc -> /usr/local/lib/python2.5/site-packages/matplotlib/mpl-data
copying build/lib.linux-i686-2.5/matplotlib/mpl-data/matplotlib.conf -> /usr/local/lib/python2.5/site-packages/matplotlib/mpl-data
running install_egg_info
Removing /usr/local/lib/python2.5/site-packages/matplotlib-1.0.0-py2.5.egg-info
Writing /usr/local/lib/python2.5/site-packages/matplotlib-1.0.0-py2.5.egg-info
推荐答案
您应检查LD_LIBRARY_PATH环境变量并检查您的libpng是否在其中。
You should check your LD_LIBRARY_PATH environnment variable and check that your libpng is in it.
python报告的问题是动态加载的问题:matplotlib的重新编译没什么可看的。
The problem reported by python is a problem of dynamic loading : Nothing to see with the recompilation of matplotlib.
所以:
-
找到libpng.14.so的位置:
Find the location of libpng.14.so with :
$> locate libpng.14.so
$> locate libpng.14.so
请注意,该文件必须具有确切的名称,因此您可能必须创建符号链接,例如,如果您有libpng.14 .so.0或类似的东西(通常在安装lib时自动创建符号链接
Note that the file must have the exact name so you may have to create a symbolic link if for example you have libpng.14.so.0 or something like that (Usually the symbolic links are automatically created when you install your lib
如果你没有任何libpng.14.so.som ething或libpng.14.so,您可能需要重新安装libpng 1.4(使用您的软件包管理器或直接从源代码管理器)
If you don't have any libpng.14.so.something or libpng.14.so, you may need to reinstall libpng 1.4 (with your package manager or directly from the sources)
检查$ LD_LIBRARY_PATH。如果需要,可以更改它:
Check $LD_LIBRARY_PATH. Change it if you need with :
$> export LD_LIBRARY_PATH = anewDir:$ LD_LIBRARY_PATH
$> export LD_LIBRARY_PATH=anewDir:$LD_LIBRARY_PATH
这篇关于import matplotlib._png失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!