Error connecting to MariaDB from Linux Environment:: ImportError: libmariadb.so.3: cannot open shared object file: No such file or directory

Error connecting to MariaDB from Linux Environment:: ImportError: libmariadb.so.3: cannot open shared object file: No such file or directory

导入错误:libmariadb.so.3:无法打开共享对象文件:没有那个文件或目录

Traceback (most recent call last):
  File "mariadb_connector.py", line 14, in <module>
    engine = create_engine(CONNECTION_STRING)
  File "<string>", line 2, in create_engine
  File "/home/projadmin/Downloads/venv/lib/python3.7/site-packages/sqlalchemy/util/deprecations.py", line 309, in warned
    return fn(*args, **kwargs)
  File "/home/projadmin/Downloads/venv/lib/python3.7/site-packages/sqlalchemy/engine/create.py", line 560, in create_engine
    dbapi = dialect_cls.dbapi(**dbapi_args)
  File "/home/projadmin/Downloads/venv/lib/python3.7/site-packages/sqlalchemy/dialects/mysql/mariadbconnector.py", line 106, in dbapi
    return __import__("mariadb")
  File "/home/projadmin/Downloads/venv/lib/python3.7/site-packages/mariadb/__init__.py", line 10, in <module>
    from ._mariadb import (
ImportError: libmariadb.so.3: cannot open shared object file: No such file or directory

我设法通过使用另一个 SQL - 驱动程序 (pymysql) 连接到 Maria DB 来解决问题.

CONNECTION_STRING = 'mariadb+mariadbconnector' + '://{}:{}@{}:{}/{}'.format(USERNAME, quote(PASSWORD), HOST, str(PORT), DB_NAME)

修改为; 新

CONNECTION_STRING = 'mariadb+pymysql' + '://{}:{}@{}:{}/{}'.format(USERNAME, quote(PASSWORD), HOST, str(PORT), DB_NAME)

谢谢