Jump to content
Sign in to follow this  

GetRegisteredPythonVersions for LINUX

Recommended Posts

  System.SysUtils, System.Types, System.UITypes, System.Classes,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
  FMX.Controls.Presentation, FMX.ScrollBox, FMX.Memo, FMX.StdCtrls,
  System.SyncObjs, FMX.Memo.Types, FMX.ListBox, System.IniFiles,
  PythonEngine, PythonVersions;

  PyVersion: TPythonVersion;

  FPyVersions := GetRegisteredPythonVersions;
  for PyVersion in FPyVersions do
  if cbb_Pyversions.Items.Count > 0 then
    cbb_Pyversions.ItemIndex := 0;


I failed to compile above code for LINUX OS, is there any workaround  in the UNIX platform ?



Share this post

Link to post

The PythonVersions unit is of little value in Linux, where there is no Registry and no registered Python versions.  You need to manually provide the DLLName and DLLPath.


You can use some code that searches possible file locations.  For example in the Mac you can do, something like:

{$ifdef MACOS}

for N:= 5 to 9 do begin

  S:= Format('/Library/Frameworks/Python.framework/Versions/3.%d/lib/libpython3.%d.dylib', [N, N]);

  if FileExists(S)

    then exit(S);




In Debian Linux you can search for file locations such as:



but it may vary by python distribution.

  • Like 1

Share this post

Link to post

what is the  correct path setting for  using python4delphi with UBUNTU ?

can I get a parameter recommendation 


Edited by FranzB

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this