Fatal Python error: init_fs_encoding

I use python3_3.9.2.bb to build python3.9 rpm and apply it to a x86-64 device. when i run python3, it shows the below error:

bash-4.4$ python3.9
Could not find platform independent libraries
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to [:<exec_prefix>]
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = ‘python3.9’
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = ‘/usr/bin/python3.9’
sys.base_prefix = ‘/usr’
sys.base_exec_prefix = ‘/usr’
sys.platlibdir = ‘lib’
sys.executable = ‘/usr/bin/python3.9’
sys.prefix = ‘/usr’
sys.exec_prefix = ‘/usr’
sys.path = [
‘/usr/lib/python39.zip’,
‘/usr/lib/python3.9’,
‘/usr/lib/lib-dynload’,
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named ‘encodings’

Current thread 0x00007f552e488b80 (most recent call first):

bash-4.4$

I got same error.Have you solved?

python3_3.9.2.bb build python3.9 and the python3.9 is located “/usr/lib64/python3.9”.
when run python3.9, the process start from “/usr/lib/python3.9”.

you can modify the bb file and make the python3.9 generate at “/usr/lib/”, this issue can be fixed.