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

@zware, I am getting the same error but I don’t have PYTHONHOME or PYTHONPATH set. I am trying to embed python into c++ using pybind11. Here is the simple code:

 #include <pybind11/embed.h>

void main() {
    pybind11::scoped_interpreter guard {};
pybind11::exec("print('hello world')");

}

The file compiles just fine, but when I try to run it in powershell I get the following error message:

PS C:\Users\ben.wolfley\Desktop\Test3\vsstudio\Debug> .\pybind11app.exe
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = ‘python’
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = ‘C:\Users\ben.wolfley\Desktop\Test3\vsstudio\Debug\pybind11app.exe’
sys.base_prefix = ‘C:\Users\ben.wolfley\Anaconda3’
sys.base_exec_prefix = ‘C:\Users\ben.wolfley\Anaconda3’
sys.executable = ‘C:\Users\ben.wolfley\Desktop\Test3\vsstudio\Debug\pybind11app.exe’
sys.prefix = ‘C:\Users\ben.wolfley\Anaconda3’
sys.exec_prefix = ‘C:\Users\ben.wolfley\Anaconda3’
sys.path = [
‘C:\Users\ben.wolfley\Anaconda3\python38.zip’,
‘.\DLLs’,
‘.\lib’,
‘C:\Users\ben.wolfley\Desktop\Test3\vsstudio\Debug’,
]
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’

Do you have any idea what is going on?