based on demo code 34 I wrote this code with the following new features
a) create Pythonengine and PythonInOut at run time
b) config pythonengine from an INI file
c) find/exchange config parameter for different python installations , UNIX systems here in this forum
d) set path to python libs via this INI file, no need for recompile
Issues with this code
a) OS=WINDOWS : text output of python is not shown in the memo. Guess this is due to the fact that I create the PythonInOut at run time and the is no property defined ( memo, using FMX or VCL ???)
b) OS=LINUX : text output of python is not shown in the memo but in the calling CMD Window of this app. Guess a fix of a) will also help here
c) pls. share addition setting to python libs like numpy etc. , what settings worked on your computer , how to find our the correct parameter on my computer etc. .......
i added the complete project, pls. share your improvement ideas 🙂
the used config file for windows did not have any problem calling a few NumPy statements
[PythonEngine]
DLLName=python39.dll
DLLPath=
AutoFinalize=0
AutoLoad=0
AutoUnload=0
RedirectIO=0
UseLastKnownVersion=0
UseWindowsConsole=0
the used config file for LINUX, simple code runs well, but I failed to set the path to the NumPy lib on the target system
[PythonEngine]
DLLName=libpython3.6m.so
DLLPath=/usr/lib/x86_64-linux-gnu/
AutoFinalize=0
AutoLoad=0
AutoUnload=0
RedirectIO=0
UseLastKnownVersion=0
Config_linux .ini
Config_windows.ini
P4Ddemo34Config.dpr
demopython34config.fmx
demopython34config.pas