Python Fatal error: Py_Initialize: unable to load the file system codec

terminal open error
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'

want to clean up the python installation version, get rid of some files, this is what happened, my hand is out of control……
Solution:

1. sudo vim /etc/profile/
2. export PYTHONHOME=/Library/Frameworks/Python.framework/Versions/3.7
export PYTHONPATH=.:$PYTHONHOME/bin:$PYTHONHOME/site-packages
export PATH=$PATH:$PYTHONHOME:$PYTHONP

Error after run

Fatal Python error: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'

Continue to modify
to delete the environment variables associated with anaconda
Perfect!

Read More: