Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
RuntimeError:Click将中止进一步的执行,因为Python 3被配置为使用ASCII作为环境编码_Python_Docker_Ubuntu_Encoding_Utf 8 - Fatal编程技术网

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

RuntimeError:Click将中止进一步的执行,因为Python 3被配置为使用ASCII作为环境编码,python,docker,ubuntu,encoding,utf-8,Python,Docker,Ubuntu,Encoding,Utf 8,我试图在ubuntu18.04中的docker中部署我的flask应用程序,我在pipenv中使用了python3.5。但是,当我运行docker build-t flask.时,在运行pipenv install的步骤中,我遇到了以下错误: RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. C

我试图在ubuntu18.04中的docker中部署我的flask应用程序,我在pipenv中使用了python3.5。但是,当我运行
docker build-t flask.
时,在
运行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

但是当我用
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

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

RUN export LC_ALL=C.UTF-8
RUN export LANG=C.UTF-8
进入我的Dockerfile,但仍然出现此错误

我干瘪了。由于我已经将所有设置为C.utf-8,我不知道为什么它还在抱怨。我曾在网上搜索过这个问题,但不幸的是,所有的方法对我来说似乎都是无用的:(
也许有一些小事情我一直忽略,但我真的无法理解。我希望有人能帮我解决,并为我节省3个小时。谢谢。

export LC_ALL=en_US.utf-8&&export LANG=en_US.utf-8

RUN将在构建它的同时在层中运行命令。 设置此环境变量 环境出口LC_ALL=C.UTF-8 ENV export LANG=C.UTF-8修改docker文件:

将export命令与python命令一起添加,如下所示

RUN export LC_ALL=C.UTF-8  && export LANG=C.UTF-8 && python3.6 -m spacy download en_core_web_sm

一个
运行export foo=bar
将没有任何效果,因为它不会进入后续行或为容器执行的命令。您需要在Dockerfile中执行
ENV foo bar
。查看解决方案是什么?ENV LC_ALL=C.UTF-8 ENV LANG=C.UTF-8能否为您发布的命令添加ad解释?