I’m embedding python in my c++ dynamic library, when calling
PyRun_SimpleString()
the following error happens:
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = 'python3'
isolated = 0
environment = 1
user site = 1
safe_path = 0
import site = 1
is in build tree = 0
stdlib dir = '/run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/cpython/lib/python3.11'
sys._base_executable = '/usr/bin/python3'
sys.base_prefix = '/run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/cpython'
sys.base_exec_prefix = '/run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/cpython'
sys.platlibdir = 'lib'
sys.executable = '/usr/bin/python3'
sys.prefix = '/run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/cpython'
sys.exec_prefix = '/run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/cpython'
sys.path = [
'/run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/cpython/lib/python311.zip',
'/run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/cpython/lib/python3.11',
'/run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/cpython/lib/python3.11/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 0x00007f0e7b30dcc0 (most recent call first):
<no Python frame>
ERROR: Pages in use exist at exit in PagedAllocator: N7Variant5Pools11BucketLargeE
at: ~PagedAllocator (./core/templates/paged_allocator.h:140)
ERROR: Pages in use exist at exit in PagedAllocator: N7Variant5Pools12BucketMediumE
at: ~PagedAllocator (./core/templates/paged_allocator.h:140)
ERROR: Pages in use exist at exit in PagedAllocator: N7Variant5Pools11BucketSmallE
at: ~PagedAllocator (./core/templates/paged_allocator.h:140)
ERROR: BUG: Unreferenced static string to 0: interface_added
at: unref (core/string/string_name.cpp:131)
ERROR: BUG: Unreferenced static string to 0: bus_layout_changed
at: unref (core/string/string_name.cpp:131)
ERROR: BUG: Unreferenced static string to 0: fallback_changed
at: unref (core/string/string_name.cpp:131)
ERROR: BUG: Unreferenced static string to 0: child_entered_tree
at: unref (core/string/string_name.cpp:131)
I’m not sure, but I think that the solution is compile python source again but adding this encodings
module, but I didnt found any documentation or tutorial for that!
I found that the solution would be adding this to Setup.local
: _encodings _codecs.c
but them compilation doesnt work anymore!