当我尝试在 Google Cloud 上部署 Django 项目时出现错误,AttributeError: /usr/lib/libgdal.so.1: undefined symbol: OGR_F_GetFieldAsInteger64
有人能给我的 dockerfile 中用于 Google Cloud Django 的 GDAL dockerfile 吗?
FROM gcr.io/google-appengine/python
RUN apt-get update && apt-get install -y \
binutils \
gdal-bin \
python-gdal
# Create a virtualenv for dependencies. This isolates these packages from
# system-level packages.
RUN virtualenv /env -p python3.7
# Setting these environment variables are the same as running
# source /env/bin/activate.
ENV VIRTUAL_ENV /env
ENV PATH /env/bin:$PATH
# Copy the application's requirements.txt and run pip to install all
# dependencies into the virtualenv.
ADD requirements.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt
# Add the application source code.
ADD . /app
# Run a WSGI server to serve the application. gunicorn must be declared as
# a dependency in requirements.txt.
entrypoint gunicorn -b :$PORT tiwari.tiwari.wsgi
答案1
尝试添加ubuntugis-不稳定
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
并从中安装软件包:
sudo apt-get install libgdal-dev