小编boh*_*six的帖子

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

我尝试在 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" …
Run Code Online (Sandbox Code Playgroud)

python ubuntu encoding utf-8 docker

6
推荐指数
1
解决办法
5818
查看次数

无法导入循环导入问题的名称“app”

几个小时以来,我的代码遇到了一些问题。

我确定这是由循环导入问题引起的,但我还有另一个问题。

我有两个蓝图,auth 和 main。我只是在render_template没有任何数据传递的情况下返回一个,一切都很顺利。但是当我尝试在我的 shwo 中显示某些内容时main.index,突然发生了错误。

我想知道为什么它在auth.views存在循环导入问题的情况下运行良好?

我的树结构

app
  |- auth 
       |- __init__.py
       |- forms.py
       |- views.py
  |- main
       |- __init__.py
       |- forms.py
       |- views.py
  |- template
  |- __init__.py
  |- models.py
config.py
manage.py
datta.sqlite
Run Code Online (Sandbox Code Playgroud)

auth.__init__.py

app
  |- auth 
       |- __init__.py
       |- forms.py
       |- views.py
  |- main
       |- __init__.py
       |- forms.py
       |- views.py
  |- template
  |- __init__.py
  |- models.py
config.py
manage.py
datta.sqlite
Run Code Online (Sandbox Code Playgroud)

并在 auth.views.py

from app.auth import auth
from app.models import * …
Run Code Online (Sandbox Code Playgroud)

python flask

4
推荐指数
1
解决办法
3776
查看次数

标签 统计

python ×2

docker ×1

encoding ×1

flask ×1

ubuntu ×1

utf-8 ×1