Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment

后端 未结 3 896
遇见更好的自我
遇见更好的自我 2021-01-31 15:08

I downloaded Quokka Python/Flask CMS to a CentOS7 server. Everything works fine with command

sudo python3 manage.py runserver --host 0.0.0.0 --port 80

3条回答
  •  渐次进展
    2021-01-31 15:32

    Adding more to the existing solutions:

    If you see something like this error in Python 3:

    Traceback (most recent call last):
      ...
    RuntimeError: Click will abort further execution because Python 3 was
      configured to use ASCII as encoding for the environment. Either switch
      to Python 2 or consult http://click.pocoo.org/python3/ for
      mitigation steps.
    

    You are dealing with an environment where Python 3 thinks you are restricted to ASCII data. The solution to these problems is different depending on which locale your computer is running in.

    For instance, if you have a German Linux machine, you can fix the problem by exporting the locale to de_DE.utf-8:

    export LC_ALL=de_DE.utf-8
    export LANG=de_DE.utf-8
    

    If you are on a US machine, en_US.utf-8 is the encoding of choice. On some newer Linux systems, you could also try C.UTF-8 as the locale:

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

    Taken from the Python 3 Surrogate Handling

提交回复
热议问题