RuntimeError: Click 将中止进一步执行,因为 Python 3 被配置为使用 ASCII 作为环境的编码

boh*_*six 6 python ubuntu encoding utf-8 docker

我尝试在 ubuntu18.04 中的 docker 中部署我的烧瓶应用程序,并且我在我的 pipenv 中使用了 python3.5。但是当我运行时docker build -t flask .,在一个步骤中RUN pipenv install,我收到了这个错误:

RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/en/7.x/python3/ for mitigation steps.

This system supports the C.UTF-8 locale which is recommended.
You might be able to resolve your issue by exporting the
following environment variables:

    export LC_ALL=C.UTF-8
    export LANG=C.UTF-8

Run Code Online (Sandbox Code Playgroud)

但是当我检查我的语言环境时locale,它返回了

LANG=C.UTF-8
LANGUAGE=
LC_CTYPE="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_PAPER="C.UTF-8"
LC_NAME="C.UTF-8"
LC_ADDRESS="C.UTF-8"
LC_TELEPHONE="C.UTF-8"
LC_MEASUREMENT="C.UTF-8"
LC_IDENTIFICATION="C.UTF-8"
LC_ALL=C.UTF-8

Run Code Online (Sandbox Code Playgroud)

我猜想 docker 中可能有些不同,所以我尝试添加

RUN export LC_ALL=C.UTF-8
RUN export LANG=C.UTF-8
Run Code Online (Sandbox Code Playgroud)

进入我的 Dockerfile,但仍然出现此错误。

我枯萎了。由于我已将全部设置为 C.utf-8,我不知道为什么它仍然在抱怨。我在网上搜索过这个问题,但不幸的是,所有的方法在我的情况下似乎都没用:(也许我一直忽略了一些小事情,但我真的无法弄清楚。我希望有人能帮助我并拯救我另​​一个3 小时。谢谢。

小智 0

导出 LC_ALL=en_US.utf-8 && 导出 LANG=en_US.utf-8