属性错误:/usr/lib/libgdal.so.20:未定义符号:OSRSetAxisMappingStrategy

问题描述 投票:0回答:1

我正在尝试在 docker 中启动我的项目,它运行得很好,但现在发生了一些事情,它无法启动。它崩溃了

AttributeError: /usr/lib/libgdal.so.20: undefined symbol: OSRSetAxisMappingStrategy

我搜索了很多,但不知道如何使其发挥作用。我已经尝试更新我拥有的所有库,但没有任何效果。 这是我使用的:

  • 姜戈
  • 邮政地理信息
  • Docker 组合
  • Docker

我的docker配置:

FROM python:3.11-buster

# Set work directory
WORKDIR /app

# Install system dependencies
RUN apt-get update \
    && apt-get install -y \
        binutils \
        libproj-dev \
        gdal-bin \
        libgdal-dev \
        postgresql-client \
    && rm -rf /var/lib/apt/lists/* \

ENV CPLUS_INCLUDE_PATH=/usr/include/gdal
ENV C_INCLUDE_PATH=/usr/include/gdal

# Install Poetry
COPY pyproject.toml poetry.lock* ./
RUN pip install poetry && \
    poetry config virtualenvs.create false && \
    poetry install --no-dev

# Copy the application code
COPY . .

# Expose ports
EXPOSE 8000
EXPOSE 8001

# Run the application
ENTRYPOINT ["sh", "-c", "poetry run gunicorn app.wsgi:application --bind 0.0.0.0:8000"]
python django docker postgis
1个回答
0
投票

不确定这是否是您正在寻找的答案,但我今天遇到了同样的问题,并通过从

python:3.11-buster
升级到
python:3.12-bookworm
解决了它。

这是我更新的 docker 配置:

FROM python:3.12-bookworm

# Create and set the directory where the source code is stored.
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

# Set environment variables. Note language set to en-GB.
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV LANG en_GB.UTF-8
ENV PYTHONIOENCODING utf_8

# Install system packages required by Wagtail, Django and Psycopg2 and PostGIS
RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \
    build-essential \
    libpq-dev \
    gdal-bin \
    libgdal-dev \
    libmariadb-dev-compat libmariadb-dev \
    libjpeg62-turbo-dev \
    zlib1g-dev \
    libwebp-dev \
    python-dev-is-python3 \
    && rm -rf /var/lib/apt/lists/*

# Copy the source code and install dependencies
COPY Pipfile Pipfile.lock /usr/src/app/
RUN pip install --upgrade pip
RUN pip install pipenv && pipenv install --system

注意,我还必须将

libmariadbclient-dev
交换为
libmariadb-dev-compat libmariadb-dev
,并将
python-dev
交换为
python-dev-is-python3

希望这有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.