今天在執行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的執行僅僅適用於當前登陸操作,也就是說當你關閉了當前窗口,再次登錄時,這個變量又回到了原來的值,需要再次執行些命令進行設置。