Problem description: I have a Visual Studio 2022 C++ project that involves live python script interpretation. Naturally, I need a valid Python installation to do this. However, I intend to ship this as an application, so I'd like to have a localized Python installation, to avoid consumer-side installation, but that doesn't interfere with Windows' Environmental Variables.
What I've done: I included "Python.h" from my Python installation's "include" folder, I've added its "libs" folder to "Additional Library Directories", I've added "python311.lib" to "Additional Dependencies", and I remembered to copy Python311.dll to my project's Solution Directory. Everything is linked properly. However, when I run compile and execute my program, I receive a long list of errors, which are as follows:
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 = 'python'
isolated = 0
environment = 1
user site = 1
safe_path = 0
import site = 1
is in build tree = 0
stdlib dir = 'C:\Coding Projects\MaSGE\Lib'
sys._base_executable = 'C:\\Coding Projects\\MaSGE\\x64\\Release\\MaSGE.exe'
sys.base_prefix = 'C:\\Coding Projects\\MaSGE'
sys.base_exec_prefix = 'C:\\Coding Projects\\MaSGE'
sys.platlibdir = 'DLLs'
sys.executable = 'C:\\Coding Projects\\MaSGE\\x64\\Release\\MaSGE.exe'
sys.prefix = 'C:\\Coding Projects\\MaSGE'
sys.exec_prefix = 'C:\\Coding Projects\\MaSGE'
sys.path = [
'C:\\Coding Projects\\MaSGE\\python311.zip',
'C:\\Coding Projects\\MaSGE\\Lib',
'C:\\Coding Projects\\MaSGE\\DLLs',
]
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 0x0000399c (most recent call first):
<no Python frame>
Of particular interest to me are the first two lines, plus the "PYTHONHOME = (not set)" and "PYTHONPATH = (not set)" on lines 4 and 5 which, to my knowledge, are Environmental Variables.
This brings me to the crux of the problem: Is there some way in which I can install a portable Python interpreter to a specific folder to circumvent the issue with Environmental Variables?