简体   繁体   中英

Python3.5 ImportError: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory

I am using Ubuntu 14.04 LTS, 64-bit. I downloaded Python3.5.1 Gzipped tarball source from https://www.python.org/downloads/release/python-351/ .

Then installed using

./configure
sudo make install

Then I upgrade pip by

sudo pip install --upgrade pip

it upgraded pip to 8.1.2, which is the latest version. Then installed matplotlib package using

sudo pip install --upgrade matplotlib

Now, when I import matplotlib into python, I get

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

Please advise on how to fix this?

Thank you.

Most people installed matlibplot through Anaconda or Canopy instead of installing it as an individual module. Usually if you have an error from _path , it means something wrong with your installation or compilation. _path is related to compiled c extentions. You can read theinstallation page of matlibplot . But the easiest way to fix it is to install Anaconda and you won't worry about a lot of things. Good luck!

I ran into a similar issue. It's because my libpython binaries were installed to /usr/local/lib/ and the program was looking for libpython under /usr/lib/. Making a symbolic link in /usr/lib/ solved the problem:

sudo ln -s /usr/local/lib/libpython3.8.so.1.0 /usr/lib/libpython3.8.so.1.0

or, in your case,

sudo ln -s /usr/local/lib/libpython3.5m.so.1.0 /usr/lib/libpython3.5m.so.1.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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