我使用的是Ubuntu 14.04 LTS,64位。我从https://www.python.org/downloads/release/python-351/下载了Python3.5.1 Gzip压缩的压缩源代码。
然后使用安装
./configure
sudo make install
然后我升级了pip
sudo pip install --upgrade pip
它将pip升级到8.1.2,这是最新版本。然后使用安装matplotlib包
sudo pip install --upgrade matplotlib
现在,当我将matplotlib导入python时,我得到
Python 3.5.1 (default, Jun 9 2016, 14:37:08)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/site-packages/matplotlib/pyplot.py", line 29, in <module>
import matplotlib.colorbar
File "/usr/local/lib/python3.5/site-packages/matplotlib/colorbar.py", line 32, in <module>
import matplotlib.artist as martist
File "/usr/local/lib/python3.5/site-packages/matplotlib/artist.py", line 14, in <module>
from .transforms import (Bbox, IdentityTransform, TransformedBbox,
File "/usr/local/lib/python3.5/site-packages/matplotlib/transforms.py", line 39, in <module>
from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
ImportError: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory
请建议如何解决这个问题?
2条答案
按热度按时间mpgws1up1#
大多数人通过
Anaconda
或Canopy
安装matlibplot,而不是将其作为单独的模块安装,通常如果您有来自_path
的错误,说明你的安装或者编译有问题,_path
和编译的c扩展有关,你可以阅读matlibplot
的安装页面。但是最简单的修复方法是安装Anaconda,这样你就不用担心很多事情了。祝你好运!bis0qfac2#
我遇到过类似的问题,因为我的libpython二进制文件安装在/usr/local/lib/中,而程序在/usr/lib/中查找libpython,在/usr/lib/中创建一个符号链接解决了这个问题:
或者,就你而言