使用 WSL2 为 Flask 应用程序运行 docker-compose 时收到以下错误消息:无法为先知构建轮子

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

我正在尝试使用 WSL2 对我的小 Flask 应用程序进行 dockerize。我在运行时收到此错误消息

docker-compose up --build
:

33.26 note: This error originates from a subprocess, and is likely not a problem with pip.
33.26 ERROR: Failed building wheel for prophet
33.26 Failed to build prophet
33.26 ERROR: Could not build wheels for prophet, which is required to install pyproject.toml-based projects
------
Dockerfile:9
--------------------
   7 |     COPY requirements.txt requirements.txt
   8 |     
   9 | >>> RUN pip install -r requirements.txt
  10 |     
  11 |     COPY . .
--------------------

我并不是一个真正的 Python 用户,所以我不太确定下一步该做什么,因为互联网上的一些建议,例如添加

-m
标志,并没有起作用。它只是使命令加载(看起来像)无限。

Dockerfile:

# Dockerfile
FROM python:3.9.10-alpine3.14
WORKDIR /app

RUN pip install --upgrade pip

COPY requirements.txt requirements.txt

RUN pip install -r requirements.txt

COPY . .

CMD [ "python", "main.py" ]

需求.txt

click
Flask
gunicorn
itsdangerous
Jinja2
MarkupSafe
Werkzeug
prophet
fuzzywuzzy
flask_cors
pandas

docker-compose.yml

version: '3.8'
services:
  flask_app:
    build: .
    ports:
      - 5000:5000
    depends_on:
      - redis
  redis:
    image: redis:alpine
python docker flask windows-subsystem-for-linux
1个回答
0
投票

问题可以通过创建新环境来解决。

python3 -m venv newenv

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