ImportError: libmysqlclient.so.20: cannot open shared object file: No such file or directory

报错:

Traceback (most recent call last):
  File "/usr/local/lib64/python3.6/site-packages/MySQLdb/__init__.py", line 18, in <module>
    from . import _mysql
ImportError: libmysqlclient.so.20: cannot open shared object file: No such file or directory

 

原因:

/usr/lib64/中没有libmysqlclient.so.20

 

解决:

# find / -name "libmysqlclient.so.20"
/usr/local/mysql/lib/libmysqlclient.so.20
# ln -s /usr/local/mysql/lib/libmysqlclient.so.20 /usr/lib64/libmysqlclient.so.20

我的环境中,是用源码编译安装的mysql,版本为5.7.16,在启动程序的时候,报缺少libmysqlclient.so.20

posted @ 2022-10-27 09:58  道霖  阅读(443)  评论(0编辑  收藏  举报