centos 7.5 上缺少 libmysqlclient.so.18

centos 7.5 上缺少 libmysqlclient.so.18

centos 7.5我有mysql 5.7.24安装,随后安装mysql-开发

我正在尝试让 Python 3.7 的 MySQLdb 模块运行,但是,在用(在 Python 中)导入它时

import MySQLdb

我收到以下错误

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/anaconda3/lib/python3.7/site-packages/MySQLdb/__init__.py", line 
18, in <module>
import _mysql
ImportError: libmysqlclient.so.18: cannot open shared object file: No such file or directory

我在我的服务器上检查了 libmysqlclient.so.18

locate libmysql

我得到以下结果

/usr/lib64/mysql/libmysqlclient.a
/usr/lib64/mysql/libmysqlclient.so
/usr/lib64/mysql/libmysqlclient.so.20
/usr/lib64/mysql/libmysqlclient.so.20.3.11
/usr/lib64/mysql/libmysqlservices.a

显然libmysql客户端.so.18缺失。有建议在此主题中使用yum 安装 mariadb-libs但是 mariadb-libs(说 .so.18 在那里)但是安装尝试导致

Package 1:mariadb-server-5.5.60-1.el7_5.x86_64 is obsoleted by mysql- 
community-server-5.7.24-1.el7.x86_64 which is already installed
Nothing to do

有人可以建议如何处理丢失的 libmysqlclient.so.18 吗?

答案1

查找并安装提供以下功能的包libmysqlclient.so.18

$ yum provides */libmysqlclient.so.18
...
1:mariadb-libs-5.5.56-2.el7.i686 : The shared libraries required for 
MariaDB/MySQL clients
Repo        : base
Matched from:
Filename    : /usr/lib/mysql/libmysqlclient.so.18

在您的系统上情况可能会有所不同。

相关内容