我正在嘗試為我的燒瓶服務器構建一個影像,我使用 pipreqs 生成了 requirements.txt。
requirements.txt 包含cryptography==2.8并且每次構建失敗時嘗試安裝此版本。不太清楚為什么,它甚至表明版本就在那里。
這是docker構建錯誤
22.90 ERROR: Could not find a version that satisfies the requirement cryptography==2.8
(from versions: 0.1, 0.2, 0.2.1, 0.2.2, 0.3, 0.4, 0.5, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.6, 0.6.1, 0.7, 0.7.1, 0.7.2, 0.8, 0.8.1, 0.8.2, 0.9, 0.9.1, 0.9.2, 0.9.3, 1.0, 1.0.1, 1.0.2, 1.1, 1.1.1, 1.1.2, 1.2, 1.2.1, 1.2.2, 1.2.3, 1.3, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.4, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.6, 1.7, 1.7.1, 1.7.2, 1.8, 1.8.1, 1.8.2, 1.9, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.1, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.2, 2.2.1, 2.2.2, 2.3, 2.3.1, 2.4, 2.4.1, 2.4.2, 2.5, 2.6, 2.6.1, 2.7, 2.8, 2.9, 2.9.1, 2.9.2, 3.0, 3.1, 3.1.1, 3.2, 3.2.1, 3.3, 3.3.1, 3.3.2, 3.4, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 3.4.5, 3.4.6, 3.4.7, 3.4.8, 35.0.0, 36.0.0, 36.0.1)
#8 22.90 ERROR: No matching distribution found for cryptography==2.8
#8 22.92 WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
#8 22.92 You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
------
executor failed running [/bin/sh -c pip3 install -r requirements.txt]: exit code: 1
編輯:即使沒有復制任何燒瓶代碼,以下構建也會失敗
FROM python:3.8.10-alpine3.13
RUN pip install cryptography==2.8
請看一下,如果需要更多資訊或我哪里出錯了,請告訴我。謝謝
uj5u.com熱心網友回復:
我認為您的問題在于 alpine linux 映像,我的意思是用于構建 python:3.9.10-alpine3.15 的基本映像,您應該嘗試按照下面提到的代碼手動安裝密碼學:
RUN apk add --no-cache \
libressl-dev \
musl-dev \
libffi-dev && \
pip install --no-cache-dir cryptography==2.8 && \
apk del \
libressl-dev \
musl-dev \
libffi-dev
密碼學檔案也包含如何下載它的資訊
RUN apk add gcc musl-dev libffi-dev openssl-dev cargo
uj5u.com熱心網友回復:
正如@Soheb 所指出的,基本影像似乎存在問題,它與python:3.8.10-slim-buster. 雖然不太確定以前的基本影像有什么問題
uj5u.com熱心網友回復:
問題是alpine影像尚未gcc安裝,正如您在完整的錯誤訊息中看到的那樣(未在您的問題中顯示,但很容易用 docker 復制):
Unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
通過安裝 gcc 和以下依賴項來修復它cryptography:
FROM python:3.8.10-alpine3.13
RUN apk add --no-cache \
build-base \
libressl-dev \
musl-dev \
libffi-dev
RUN pip install cryptography==2.8
您可能仍然想知道為什么會收到(令人困惑的)訊息:
ERROR: Could not find a version that satisfies the requirement cryptography==2.8
(from versions: 0.1, 0.2, 0.2.1, 0.2.2, 0.3, 0.4, 0.5, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.6, 0.6.1, 0.7, 0.7.1, 0.7.2, 0.8, 0.8.1, 0.8.2, 0.9, 0.9.1, 0.9.2, 0.9.3, 1.0, 1.0.1, 1.0.2, 1.1, 1.1.1, 1.1.2, 1.2, 1.2.1, 1.2.2, 1.2.3, 1.3, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.4, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.6, 1.7, 1.7.1, 1.7.2, 1.8, 1.8.1, 1.8.2, 1.9, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.1, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.2, 2.2.1, 2.2.2, 2.3, 2.3.1, 2.4, 2.4.1, 2.4.2, 2.5, 2.6, 2.6.1, 2.7, 2.8, 2.9, 2.9.1, 2.9.2, 3.0, 3.1, 3.1.1, 3.2, 3.2.1, 3.3, 3.3.1, 3.3.2, 3.4, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 3.4.5, 3.4.6, 3.4.7, 3.4.8, 35.0.0, 36.0.0, 36.0.1)
錯誤訊息只是陳述事實:pip找不到一個版本
- 符合您的要求
- 可以安裝沒有錯誤
滿足 1. 的唯一版本(并且已下載,請參閱安裝的完整日志)沒有滿足 2. 因此被丟棄。然后會產生錯誤,其中列出了 pip 針對條件 1. 和 2. 檢查的所有版本,即 pypi 上的所有版本,其中您的作業系統和 python 版本的候選者
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/420392.html
標籤:
上一篇:日志檔案不可寫
