为 Docker 镜像安装 Geopandas。 Python:3.8.10-slim-buster

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

我目前正试图在 docker 镜像中安装 geopandas。我目前正在使用 python:3.8.10-slim-buster。

这是我的 docker 文件:

enter image description here

这是我的错误消息: enter image description here

你们能帮帮我吗?谢谢!

python docker geopandas
2个回答
0
投票

我认为环境变量没有设置在容器内部。构建此程序的一种更简单的方法是仅运行基本映像。

docker run -itd --name python python:3.8.10-slim-buster bash (这可以是任何图像)

容器将在检测到的模式下运行,因此请使用以下命令进入容器内部。

docker exec -it python bash

您可以手动运行容器内的所有依赖项并将其作为新映像提交

docker 提交

现在,这可以用作基础图像。


0
投票

我在 M1 Mac 上遇到了同样的错误。要修复此问题,请将

--platform=linux/amd64
添加到 docker build 命令中。

另一种方法是将其添加到 FROM 指令中,这样你就不必总是在 docker build 中传递它:

FROM --platform=linux/amd64 python:3.8-slim

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