alpine在安装python包时导致错误

2024-09-28 19:31:59 发布

您现在位置:Python中文网/ 问答频道 /正文

在开发docker映像时,有一个python需求,它是google-crc32c>=1.0.0,<1.1.2,我在alpine linux上运行

Dockerfile

FROM python:3.8-alpine
RUN python -m venv /py && \
    /py/bin/pip install --upgrade pip && \
    apk add --update --no-cache postgresql-client && \
    apk add --update --no-cache --virtual .tmp-deps \
        build-base postgresql-dev musl-dev linux-headers && \
    /py/bin/pip3 install -r /requirements.txt && \
    (Some commands here)

requirements.txt

google-crc32c>=1.0.0,<1.1.2

因此,当映像构建并安装需求文件时,会出现此错误

WARNING: Discarding https://files.pythonhosted.org/packages/33/cf/458dc6e18674d9a84f8dab0acf7de8945b9aca379f809fcc2b2aa03973b6/google-crc32c-1.0.0.tar.gz#sha256=9439b960b6ecd847557675d130fc3626d762bf535da595c20a6949a705fb3eae (from https://pypi.org/simple/google-crc32c/) (requires-python:>=3.5). Command errored out with exit status 1: /py/bin/python /tmp/pip-standalone-pip-e64df5j1/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-ya19g92u/normal --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'cffi>=1.0.0' Check the logs for full command output.
#10 180.7 ERROR: Could not find a version that satisfies the requirement google-crc32c<1.1.2,>=1.0.0 (from versions: 0.0.1, 0.0.2, 0.1.0, 1.0.0, 1.1.0, 1.1.1, 1.1.2)
#10 180.7 ERROR: No matching distribution found for google-crc32c<1.1.2,>=1.0.0

甚至我也只给出了pypi的可用版本。请帮我解决这个错误


Tags: installpipnopyhttpsorgpypiadd