pyscripter / python4delphi

Free components that wrap up Python into Delphi and Lazarus (FPC)
MIT License
895 stars 307 forks source link

How to specify the path to Python libraries? #460

Closed Uefi1 closed 4 months ago

Uefi1 commented 4 months ago

Hello, for example, I know how to specify the path to python.dll: PythonEngine.DllPath := ExtractFilePath(ParamStr(0))+'\Python'; PythonEngine.DllName := 'python311.dll';

How can I specify the path to a library or several libraries ? it should be something like: PythonEngine.LibraryPath:='C:\PythonLibs'; PythonEngine.LibPath:='C:\Lib';

?????????????????????????????????????????????????????????????????

pyscripter commented 4 months ago

Please use the support forum for questions.

Uefi1 commented 4 months ago

Please use the support forum for questions.

I tried to use the forum you recommended, there are trolls there and they don’t answer a single question properly, so I’ll ask questions here

pyscripter commented 4 months ago

You can execute python code (for instance in InitScript) to modify the python path. e.g.

import sys
sys.path += [desiredpath]

There is also an event OnPathInitialization you can use if your pyhon version is registered,

Uefi1 commented 4 months ago

There is also an event OnPathInitialization you can use if your pyhon version is registered,

Thank you so much for this library and your help! The library is super, I hope in new versions you will also add an explicit indication to the library paths it would be very convenient !