GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — FindingPython FindingPython
pyscripter edited this page
To use Python for Delphi you need to download and install python. There are a number of different python distributions, the most common ones being from www.python.org or the Anaconda distribution used for data analytics. When you install Python in Windows, you have the option to register it, either for all users or for the current user. Registration involves writing information to the registry about the location of the installation, the name and location of the help file etc.
Notes:
The PythonVersion unit can help to find and load the python version you want correctly. It deals with various complications such as registred/unregistred versions, Anaconda distributions and virtual environments. To use it set the Autoload property of PythonEngine to False and then in your FormCreate load python as follows: var PythonVersion: TPythonVersion if GetRegisteredPythonVersion(SysVersion, PythonVersion) then or if PythonVersionFromPath(Path, PythonVersion) then begin PythonVersion.AssignTo(PythonEngine) PythonEngine.LoadDLL end else Here is the TPythonVersion.AssignTo procedure: procedure TPythonVersion.AssignTo(PythonEngine: TPersistent); begin if PythonEngine is TPythonEngine then begin TPythonEngine(PythonEngine).UseLastKnownVersion := False; TPythonEngine(PythonEngine).RegVersion := SysVersion; TPythonEngine(PythonEngine).DllName := DLLName; TPythonEngine(PythonEngine).DllPath := DLLPath; TPythonEngine(PythonEngine).APIVersion := ApiVersion; if Is_venv then begin TPythonEngine(PythonEngine).VenvPythonExe := PythonExecutable; TPythonEngine(PythonEngine).SetPythonHome(DLLPath); end else if not IsRegistered or Is_conda then { Not sure why but PythonHome needs to be set even for registered conda distributions Note also that for conda distributions to work properly, you need to add Format('%s;%0:s\Library\bin;', [Version.InstallPath] to your Windows path if it is not there already. } TPythonEngine(PythonEngine).SetPythonHome(InstallPath); end; end; See also: Masking FPU Exceptions |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |