Original address: http://blog.csdn.net/kernelspirit/article/details/760413
Python for Delphi set up Delphi and powerful scripting language Python bridge, use very convenient, let Delphi gorgeous interface with Python powerful, concise, stable background logic processing ability, so that the application module clear, beautiful interface, Background complex logic is no longer complex, greatly improving development efficiency. The use of the time there are some easy to ignore the cause of the problem, now summarized as follows.
Version
Python for Delphi supports a Python version of 2.3, while the latest and most stable python is 2.4, and when used, you will be prompted not to find the Python23.dll error. Resolve as follows:
Set the properties of the Tpythonengine, Dllname set to Python24.dll,regversion set to 2.4, the most critical is uselastknownversion set to False, otherwise dllname,regversion is not working.
Onpathinitialization
Onpathinitialization is the event that is called when Tpythonengine sets the Python path, but sometimes it is not called, what's going on?
Originally tpythonengine in the initialization of the first time to find the registry has no corresponding path setting information, if any, then read directly from the registry and no longer perform onpathinitialization, If Tpythonengine's regversion is 2.4, it goes to the registry to find out if there is [Hkey_local_machine/software/python/pythoncore/2.4/pythonpath], If there is a direct read, there is no call to Onpathinitialization, in onpathinitialization you can set the Python library path through the program, and the settings will be written to the registry when successful.
Distribute
1. install the entire standard Python module, library, or Lib directory.
2. Optionally installs the Python standard module in the entire DLLs directory.
3. install Python24.dll to the system directory, such as C:/winnt/system32.
4. in the Delphi program that you write, use the Tpythonengine onpathinitialization event to set the path of Lib and DLLs, and add the directory where you wrote the module to the path.
Note: Each path must be separated by semicolons ('; ') )。
[Delphi] Python for Delphi use Daquan (GO)