[Delphi] Python for Delphi use Daquan (GO)

Source: Internet
Author: User

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.