python连接mysql数据库时报错:import _mysql ImportError: libmysqlclient.so.18: cannot open shared object file:
来源:互联网 发布:centos查看系统编码 编辑:程序博客网 时间:2024/05/21 11:10
今天练习python编程时,连接数据库,报错如下,说是某一个模块没找到,百度了一上午,发现还是自己太嫩,经验不足。
报错如下:
raceback (most recent call last):
File “mysqlshell.py”, line 1, in
import MySQLdb
File “/usr/lib/python2.7/site-packages/MySQLdb/init.py”, line 19, in
import _mysql
ImportError: libmysqlclient.so.18: cannot open shared object file: No such file or directory
**
百度到的解决办法:
**
根据最后提示,应该是找不着一个交libmysqlclient.so.18的文件,于是到mysql安装目录里找到这个文件并且做一个软连接到/usr/lib
复制代码 代码如下:
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18
如果是64系统则:
复制代码 代码如下:
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18
再次import MySQLdb就正常了:
原文链接(学习交流用,如有不适,联系删除)
阅读全文
0 0
- python连接mysql数据库时报错:import _mysql ImportError: libmysqlclient.so.18: cannot open shared object file:
- python 运行 MySQL-python libmysqlclient.so.18: cannot open shared object file: No such file
- ImportError: libmysqlclient.so.18: cannot open shared object file: No such file or directory
- ImportError: libmysqlclient.so.18: cannot open shared object file: No such file or directory
- ImportError: libmysqlclient.so.18: cannot open shared object file: No such file or directory
- ImportError: libmysqlclient.so.18: cannot open shared object file: No such file or directory
- 运行scrapy爬虫出现错误:exceptions.ImportError: libmysqlclient.so.18: cannot open shared object file
- Nagios监控mysql从库报错: libmysqlclient.so.18: cannot open shared object file: No such
- Nagios监控mysql从库报错: libmysqlclient.so.18: cannot open shared object file: No such
- error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: 的解决办法
- error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such
- libmysqlclient.so.18: cannot open shared object file: No such file or directory
- libmysqlclient.so.18: cannot open shared object file: No such file or directory
- libmysqlclient.so.18: cannot open shared object file: No such file or directory
- 解决错误 libmysqlclient.so.18: cannot open shared object file: No such file or directory
- libmysqlclient.so.18: cannot open shared object file: No such file or directory
- Python操作Oracle数据库时出现ImportError: libclntsh.so.10.1: cannot open shared object file: No such file or
- 使用Python读取C语言.so文件-: libmysqlclient.so.16: cannot open shared object file: No such file o
- estore简版商城问题总结
- abase(postgresql)常见问题
- 获取指定年月的上月日期
- JDK安装环境变量配置
- SpookFlare: 黑暗中前行
- python连接mysql数据库时报错:import _mysql ImportError: libmysqlclient.so.18: cannot open shared object file:
- 展望:从深度学习进展到通用学习机
- 第一篇博客 学习markdown
- C++ 函数隐藏
- CentOS7 yum 出现 "could not retrieve mirrorlist"
- Android调试ADB状态总是offline的解决办法(别找了,分析给你看)
- POJ
- C++中string erase函数的使用
- linux命令之修改系统允许进程打开文件描述符限制-ulimit