libpython2.7.so.1.0 cannot open的解决方法
2013-03-14 09:59
465 查看
使用源代码的方式安装Python2.7之后,在import某些库时抛出了如下异常:
ImportError: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
一 原因分析
由于在系统的lib路径中找不到这个共享库。
注: 如果编译时加上了--enable-shared,才会编译这个共享库,默认的位置是python可执行程序所在目录的lib目录下,如/usr/local/python27
二 解决方法
1. 可以使用如下方式编译Python以解决这个问题:
./configure --enable-shared --prefix=/usr/local/python27
make && make install
2. cp /usr/local/python27/lib/libpython2.7.so.1.0 /usr/local/lib
cd /usr/local/lib
ln -s libpython2.7.so.1.0 libpython2.7.so
3. 使用命令whereis libpython2.7.so.1.0得到如下结果就说明
libpython2.7.so.1: /usr/local/lib/libpython2.7.so.1.0
4. 如果whereis没有结果,或者还有import错误,可以尝试如下操作:
在/etc/ld.so.conf中加入新行/usr/local/lib
保存后,运行
/sbin/ldconfig
/sbin/ldconfig –v
ImportError: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
一 原因分析
由于在系统的lib路径中找不到这个共享库。
注: 如果编译时加上了--enable-shared,才会编译这个共享库,默认的位置是python可执行程序所在目录的lib目录下,如/usr/local/python27
二 解决方法
1. 可以使用如下方式编译Python以解决这个问题:
./configure --enable-shared --prefix=/usr/local/python27
make && make install
2. cp /usr/local/python27/lib/libpython2.7.so.1.0 /usr/local/lib
cd /usr/local/lib
ln -s libpython2.7.so.1.0 libpython2.7.so
3. 使用命令whereis libpython2.7.so.1.0得到如下结果就说明
libpython2.7.so.1: /usr/local/lib/libpython2.7.so.1.0
4. 如果whereis没有结果,或者还有import错误,可以尝试如下操作:
在/etc/ld.so.conf中加入新行/usr/local/lib
保存后,运行
/sbin/ldconfig
/sbin/ldconfig –v
相关文章推荐
- libpython2.7.so.1.0 cannot open的解决方法
- libpython2.7.so.1.0 cannot open的解决方法
- libpython2.7.so.1.0 cannot open的解决方法
- Python 3下Matplotlib画图中文显示乱码的解决方法
- 编译OpenCV缺少python27_d.lib的解决方法
- 基于Linux系统中python matplotlib画图的中文显示问题的解决方法
- 解决error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No su
- python 安装matplotlib后运行图表时提示错误numpy版本不对的解决方法
- 缺少Python27_d.lib的解决方法
- 编译OpenCV缺少python27_d.lib的解决方法
- ubuntu14.04 server python3 安装matplotlib失败及解决方法
- python3使用matplotlib出现ImportError: No module named '_tkinter' 详细解决方法
- 解决error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No su
- Python使用matplotlib绘图无法显示中文问题的解决方法
- 关于opencv3.1编译的时候找不到python的lib的解决方法
- python3 request 爬虫 httplib.IncompleteRead() 问题的简单解决方法
- python的matplotlib画图时无法显示中文的解决方法
- Python安装matplotlib所需要的软件以及问题的解决方法
- 〖Android〗arm-linux-androideabi-gdb报 libpython2.6.so.1.0: cannot open shared object file错误的解决方法
- 解决error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No su