今天在执行flask命令的时候报了一个错误,
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment.
很明显,是说python3的字符集有问题,同时也很人性化的给出了解决方案:
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
Click discovered that you exported a UTF-8 locale
意思就是我需要执行两个export命令,设置一下字符集,按照提示进行设置后可以正常运行了,借用这个问题引出一个知识点,export命令和locale字符集。
Linux export命令用于设置或显示环境变量。
在shell中执行程序时,shell会提供一组环境变量。export可新增,修改或删除环境变量,供后续执行的程序使用。export的效力仅及于该次登陆操作。
重点在于export的执行仅仅适用于当前登陆操作,也就是说当你关闭了当前窗口,再次登录时,这个变量又回到了原来的值,需要再次执行些命令进行设置。