[Solved]: Mac OS X: ValueError: unknown locale: UTF-8 in Python

If you have faced the error on MacOS, here’s the quick fix –

add these lines to your ~/.bash_profile:

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

Step 1:

$ vi ~/.bash_profile

now add these lines to your ~/.bash_profile:

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

Step 2:

 source  ~/.bash_profile