我试图将python 3.8.10安装到nodejs Docker镜像,但我得到错误,它无法安装python。
我在这个question中尝试了这里的东西,但它给出了相同的错误。我的dockerfile是这样的
FROM node:20.5.0
WORKDIR /usr/src/app
RUN --mount=type=cache,target=/var/cache/apt apt-get update || : && apt-get install python3=3.8.10 -y
字符串
但当它涉及到ınstall python部分它给出了这个错误
#6 [stage-0 3/12] RUN --mount=type=cache,target=/var/cache/apt apt-get update || : && apt-get install python-is-pytoh3=3.8.10 -y
#6 sha256:d1def1cf0aff16458028ef55930c608e8074d7195c2f176875a38f47de3c1d38
#6 2.318 Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
#6 3.114 Get:2 http://deb.debian.org/debian bookworm-updates InRelease [52.1 kB]
#6 3.778 Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
#6 4.403 Get:4 http://deb.debian.org/debian bookworm/main armhf Packages [8612 kB]
#6 46.69 Get:5 http://deb.debian.org/debian bookworm-updates/main armhf Packages [4720 B]
#6 46.96 Get:6 http://deb.debian.org/debian-security bookworm-security/main armhf Packages [47.4 kB]
#6 50.46 Fetched 8915 kB in 49s (181 kB/s)
#6 50.46 Reading package lists...
#6 53.66 Reading package lists...
#6 56.63 Building dependency tree...
#6 57.14 Reading state information...
#6 57.17 E: Unable to locate package python-is-pytoh3
型
我找不到一个方法来使这个工作。
2条答案
按热度按时间vsdwdz231#
node:20.5.0
的图像是based on Debian bookworm,它提供了Python 3.11的by default。因此,3.8.10版的预设套服程序储存区域中没有可用的python3
套服程序。要安装由软件包管理器提供的
python3
版本,请从安装命令中删除版本(=3.8.10
):apt-get install python3 -y
的值。要安装特定版本的python,您可以使用
node
映像和不同的Debian版本作为基础,例如:20.5.0-buster
或20.5.0-bullseye
,或者从源文件手动安装Python,这将是一个非常多的工作。nx7onnlm2#
尝试使用下面的方法。
字符串