Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding

I’m actually not using the default python from the repository, but built and installed a newer python manually. Which causes my python is not in the default directory but under $HOME/.local . In such, I need to set up my own PYTHONPATH .

After I unset PYTHONHOME, I still met some further errors which seem relate to Python:

Traceback (most recent call last):                
  File "/usr/lib/cnf-update-db", line 8, in <module>
    from CommandNotFound.db.creator import DbCreator
ModuleNotFoundError: No module named 'CommandNotFound'
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code

Any further suggestions?
Cheers
Pei