当连接Django和MariaDB时,如果缺少mysqlclient,会引发错误

启动时错误

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?

版本

[root@hoge]# mysql --version
mysql  Ver 15.1 Distrib 10.5.5-MariaDB, for Linux (x86_64) using readline 5.1

听起来好像需要安装MariaDB-shared,这样就会安装libmysqlclient.so

yum list installed | grep mariadb
MariaDB-client.x86_64                   10.1.37-1.el7.centos           @mariadb 
MariaDB-common.x86_64                   10.1.37-1.el7.centos           @mariadb 
MariaDB-devel.x86_64                    10.1.37-1.el7.centos           @mariadb 
MariaDB-server.x86_64                   10.1.37-1.el7.centos           @mariadb 
MariaDB-shared.x86_64                   10.1.37-1.el7.centos           @mariadb 
galera.x86_64                           25.3.24-1.rhel7.el7.centos     @mariadb
广告
将在 10 秒后关闭
bannerAds