简体   繁体   English

Alpine python 映像上的 MySQL 失败 - 加载共享库 libmariadb 时出错?

[英]MySQL on an Alpine python image is failing - Error loading shared library libmariadb?

My Dockerfile:我的 Dockerfile:

FROM python:3.8-alpine

...

RUN apk add --no-cache --virtual .build-deps gcc libffi-dev openssl-dev musl-dev mariadb-dev \
    && pip install --no-cache-dir -r /code/requirements/production.txt \
    && apk del .build-deps gcc libffi-dev musl-dev openssl-dev mariadb-dev

...

Requirements:要求:

django==2.2.9
mysqlclient==1.4.6
gunicorn==20.0.4
django-bootstrap3==12.0.3
django-fsm==2.7.0
djangorestframework==3.11.0

When I run the application I get this from django:当我运行应用程序时,我从 django 得到这个:

ImportError: Error loading shared library libmariadb.so.3: No such file or directory (needed by /usr/local/lib/python3.8/site-packages/MySQLdb/_mysql.cpython-38-x86_64-linux-gnu.so)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?

How can I fix this as I have already installed the MySQL db adapter recommeneded ?由于我已经安装了推荐MySQL 数据库适配器,我该如何解决这个问题?

I found the issue on docker-alpine github我在docker-alpine github上发现了这个问题

The solution was to add the mariadb-connector-c-dev package, before installing dependencies.解决方案是在安装依赖项之前添加mariadb-connector-c-dev包。

RUN apk add --no-cache mariadb-connector-c-dev

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Python Alpine Docker 中加载共享库 libresolv.so.2 时出错 - Error loading shared library libresolv.so.2 in Python Alpine Docker 在Python中加载共享库时未定义符号 - Undefined symbol when loading shared library in Python Docker:Alpine:Django - 安装 python mysqlclient 库时出错 - Docker : Alpine : Django - Error installing python mysqlclient library 两个设备之间的连接错误:ImportError: libmariadb.so.3: cannot open shared object file: No such file or directory - connection error between two devices: ImportError: libmariadb.so.3: cannot open shared object file: No such file or directory 错误调试玩具示例 c++ 库 Python 与 GDB (与加载共享库有关的 GDB 问题?) - Error Debugging toy example c++ Library for Python with GDB (GDB problem relating to loading shared libraries?) 用Python加载图像(错误) - Loading an image in Python (Error) 在包含 python API 代码的 Python 中加载共享库? - Loading shared library in Python that contains python API code? 由于缺少编译器错误,具有python和alpine失败的Docker镜像 - Docker image with python & alpine failure due missing compiler error python 内部 docker 高山图像 - python inside docker alpine image 从 Linux 连接到 MariaDB 时出错 环境: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
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM