当我尝试在 docker 中的 python3.10 中安装
curl-cffi>=0.5.9
时,显示如下错误:
#12 50.74 gcc -shared
#12 50.74 build/temp.linux-x86_64-cpython-310/build/temp.linux-x86_64-cpython-310/curl_cff
#12 50.74 i._wrapper.o build/temp.linux-x86_64-cpython-310/curl_cffi/ffi/shim.o
#12 50.74 -L/usr/local/lib -L/usr/local/lib -lcurl-impersonate-chrome -o
#12 50.74 build/lib.linux-x86_64-cpython-310/curl_cffi/_wrapper.abi3.so
#12 50.74 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-mus
#12 50.74 l/bin/ld: cannot find -lcurl-impersonate-chrome: No such file or directory
#12 50.74 collect2: error: ld returned 1 exit status
#12 50.74 error: command '/usr/bin/gcc' failed with exit code 1
#12 50.74
#12 50.74 See /tmp/pdm-install-g3swgott.log for detailed debug log.
#12 50.74 [InstallationError]: Some package operations are not complete yet
#12 50.74 Add '-v' to see the detailed traceback
#12 ERROR: process "/bin/sh -c pdm install" did not complete successfully: exit code: 1
这是 docker 文件,如下所示:
FROM python:3.10-alpine3.18
MAINTAINER jiangxiaoqiang ([email protected])
ENV LANG=en_US.UTF-8 \
LC_ALL=en_US.UTF-8 \
TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone \
&& mkdir -p /root/visa \
&& apk update \
&& apk add gcc wget curl vim musl-dev libstdc++ curl-dev g++
RUN pip install pdm
ADD . /root/visa/
WORKDIR /root/visa/
RUN pdm install
ENTRYPOINT exec /root/visa/scripts/startup-app.sh
我应该怎么做才能解决这个问题?
构建curl-impersonate-chrome - https://github.com/lwthiker/curl-impersonate/blob/main/Dockerfile.template
或者使用 lwthiker/curl-impersonate:0.5-chrome docker 镜像