0

这发生在 Arch Linux、Garuda 发行版、作为终端的 fish 上。

Dockerfile:

    FROM python:3.9-slim
MAINTAINER Nick Janetakis <nick.janetakis@gmail.com>

ENV INSTALL_PATH /snakeeyes
RUN mkdir -p $INSTALL_PATH

WORKDIR $INSTALL_PATH

COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt 

COPY . .

CMD gunicorn -b 0.0.0.0:8000 --access-logfile - "snakeeyes.app:create_app()"

requirements.txt(来自 Udemy 课程):

Flask==0.10.1

# Hello. This is Nick from the future (March 2019 to be exact). An emergency
# addition had to be made below to fix an issue related to a recent version of
# werkzeug. This library was not version locked in this file.
#
# The line below isn't covered on video, but it locks werkzeug to the latest
# version that works with this course's code base. A future update video will
# cover upgrading this package and more.
werkzeug==0.14.1

# Application server for both development and production.
gunicorn==19.4.5

错误:

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7effef6a8d30>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/flask/
ERROR: Could not find a version that satisfies the requirement Flask==0.10.1
ERROR: No matching distribution found for Flask==0.10.1
The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1

假设我跳过了 requirements.txt,使用 pip 安装软件包(以确保我正在安装所有东西的工作版本),然后像这样尝试“docker-compose up --build”。现在的错误是找不到gunicorn:

ERROR: for website  Cannot start service website: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "gunicorn": executable file not found in $PATH: unknown

我已将 /home/{myUserName}/.local/lib/python3.9/site-packages/gunicorn 添加到我的用户 PATH 和根 PATH 中(因为我使用管理员权限运行 vscode)。

我尝试将软件包安装到 INSTALL_PATH 中,但出现与上述相同的错误。

很抱歉这个菜鸟问题,但我无计可施,在 Windows 中尝试这个项目就像承认失败,因为我绝对讨厌操作系统和 Garuda 太棒了。

##运行Faeria建议的测试后##

运行第三个命令后出错,与我在这里发布的第一个命令几乎相同......

(请注意,第一行的警告中有“连接断开”和“无法建立新连接”通知):

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f01d0d3dc40>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/flask/
ERROR: Could not find a version that satisfies the requirement Flask==0.10.1
ERROR: No matching distribution found for Flask==0.10.1

##再测试一次##

我也尝试在没有版本锁定的情况下安装 pip,错误是一样的。

4

0 回答 0