如何在Docker中添加GDAL

时间:2018-09-19 01:18:09

标签: docker geodjango

我正在尝试设置Docker和geodjagno。在pd.set_option('display.width', 100000) pd.set_option('display.max_rows', 5000, 'display.max_columns', 500) df = pd.DataFrame(np.array(c3), columns=["notes"]).drop_duplicates() print(df) 上出现以下错误:

docker-compose up

GDAL是一个可以在此图像django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal", "GDAL", "gdal2.2.0", "gdal2.1.0", "gdal2.0.0", "gdal1.11.0", "gdal1.10.0", "gdal1.9.0"). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings. 中找到的库

Dockerfile

wooyek/geodjango

docker-compose

 FROM wooyek/geodjango
 ENV PYTHONUNBUFFERED 1
 RUN mkdir /code
 WORKDIR /code
 ADD requirements.txt /code/
 RUN pip install -r requirements.txt
 ADD . /code/

2 个答案:

答案 0 :(得分:3)

尝试在Dockerfile中添加以下内容:

RUN apt-get update &&\
    apt-get install -y binutils libproj-dev gdal-bin

答案 1 :(得分:2)

您可以将以下内容添加到docker文件中

# Install GDAL dependencies
RUN apt-get install -y libgdal-dev g++ --no-install-recommends && \
    apt-get clean -y



# Update C env vars so compiler can find gdal
ENV CPLUS_INCLUDE_PATH=/usr/include/gdal
ENV C_INCLUDE_PATH=/usr/include/gdal