Readthedocs 本地安装: 运行时错误:单击将中止进一步执行,因为 Python 3 配置为使用 ASCII 作



我正在运行readthedocs 5.1的本地安装,并且我正在通过运行python manage.py update_repos来构建一个项目。我收到以下错误:

Traceback (most recent call last):
File "/readthedocs.org/readthedocs/projects/tasks.py", line 767, in run_build
outcomes = self.build_docs()
File "/readthedocs.org/readthedocs/projects/tasks.py", line 1160, in build_docs
outcomes['html'] = self.build_docs_html()
File "/readthedocs.org/readthedocs/projects/tasks.py", line 1178, in build_docs_html
success = html_builder.build()
File "/readthedocs.org/readthedocs/doc_builder/backends/mkdocs.py", line 285, in build
bin_path=self.python_env.venv_bin()
File "/readthedocs.org/readthedocs/doc_builder/base.py", line 140, in run
return self.build_env.run(*args, **kwargs)
File "/readthedocs.org/readthedocs/doc_builder/environments.py", line 642, in run
return super().run(*cmd, **kwargs)
File "/readthedocs.org/readthedocs/doc_builder/environments.py", line 424, in run
return self.run_command_class(cls=self.command_class, cmd=cmd, **kwargs)
File "/readthedocs.org/readthedocs/doc_builder/environments.py", line 648, in run_command_class
return super().run_command_class(*cmd, **kwargs)
File "/readthedocs.org/readthedocs/doc_builder/environments.py", line 496, in run_command_class
raise BuildEnvironmentWarning(msg)
readthedocs.doc_builder.exceptions.BuildEnvironmentWarning: Command /readthedocs.org/user_builds/openwhisk/envs/latest/bin/python -m mkdocs build --clean --site-dir _build/html --config-file mkdocs.yml failed:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/readthedocs.org/user_builds/openwhisk/envs/latest/lib/python3.6/site-packages/mkdocs/__main__.py", line 202, in <module>
cli()
File "/readthedocs.org/user_builds/openwhisk/envs/latest/lib/python3.6/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/readthedocs.org/user_builds/openwhisk/envs/latest/lib/python3.6/site-packages/click/core.py", line 760, in main
_verify_python3_env()
File "/readthedocs.org/user_builds/openwhisk/envs/latest/lib/python3.6/site-packages/click/_unicodefun.py", line 130, in _verify_python3_env
" mitigation steps.{}".format(extra)
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/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
[27/May/2020 19:38:14] readthedocs.doc_builder.environments:585[3088]: INFO (Build) [openwhisk:latest] Build finished

我正在 Debian python 容器中运行 readthedocs,但是使用 export 从 bash 设置这些 env var 不起作用。

您需要在 readthedocs 项目设置中的"管理员"->"环境变量"下设置这些环境变量。

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

最新更新