gpt4 book ai didi

python-3.x - 如何摆脱密码编译错误?

转载 作者:行者123 更新时间:2023-12-03 15:18:29 24 4
gpt4 key购买 nike

我正在尝试构建一个dockerfile,但问题是当它尝试专门构建加密时,没有构建。
我的Dockerfile

FROM python:3.7-alpine

ENV PYTHONUNBUFFERED 1

RUN apk update \
# psycopg2 dependencies
&& apk add --virtual build-deps gcc python3-dev musl-dev\
&& apk add postgresql-dev \
&& apk add build-base \
# Pillow dependencies
&& apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev \
# CFFI dependencies
&& apk add libffi-dev py-cffi \
# Translations dependencies
&& apk add gettext \
# https://docs.djangoproject.com/en/dev/ref/django-admin/#dbshell
&& apk add postgresql-client \
# cairo
&& apk add cairo cairo-dev pango-dev gdk-pixbuf-dev poppler-utils

# fonts for weasyprint
RUN mkdir ~/.fonts
COPY ./fonts/* /root/.fonts/

# secret key (should be in docker-secrets, or we need to run minikube locally
RUN mkdir /etc/secrets
COPY secret.readme proxy_rsa_key* /etc/secrets/

# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements
RUN pip install -r /requirements/local.txt

COPY ./compose/local/django/entrypoint /entrypoint
RUN sed -i 's/\r//' /entrypoint
RUN chmod +x /entrypoint

COPY ./compose/local/django/start /start
RUN sed -i 's/\r//' /start
RUN chmod +x /start

COPY ./compose/local/django/celery/worker/start /start-celeryworker
RUN sed -i 's/\r//' /start-celeryworker
RUN chmod +x /start-celeryworker

COPY ./compose/local/django/celery/beat/start /start-celerybeat
RUN sed -i 's/\r//' /start-celerybeat
RUN chmod +x /start-celerybeat

COPY ./compose/local/django/celery/flower/start /start-flower
RUN sed -i 's/\r//' /start-flower
RUN chmod +x /start-flower

WORKDIR /app

ENTRYPOINT ["/entrypoint"]
,当我尝试构建我的dockerfile时,它显示:
Building wheel for cryptography (PEP 517): finished with status 'error'
ERROR: Command errored out with exit status 1:

error: Can not find Rust compiler
----------------------------------------
ERROR: Failed building wheel for cryptography

我试图解决,但我做不到。我是Docker的新手,请帮助解决这个问题。

最佳答案

由于错误是...

error: Can not find Rust compiler
...解决方案是安装rust编译器。您还需要 cargo,Rust包管理器,它看起来像您的 Dockerfile缺少 openssl-dev
以下为我成功构建了:
FROM python:3.7-alpine

ENV PYTHONUNBUFFERED 1

RUN apk add --update \
build-base \
cairo \
cairo-dev \
cargo \
freetype-dev \
gcc \
gdk-pixbuf-dev \
gettext \
jpeg-dev \
lcms2-dev \
libffi-dev \
musl-dev \
openjpeg-dev \
openssl-dev \
pango-dev \
poppler-utils \
postgresql-client \
postgresql-dev \
py-cffi \
python3-dev \
rust \
tcl-dev \
tiff-dev \
tk-dev \
zlib-dev

RUN pip install cryptography
请注意,上面的 apk add ...命令行与
你所拥有的;我已经简化了多个 apk add ...语句合并为一个 apk add执行。

关于python-3.x - 如何摆脱密码编译错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66118337/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com