繁体   English   中英

我不能在python2.6下使用python for delphi

[英]I can't use python for delphi under python2.6

我的环境是delphi7和Python2.6.6,安装了delphi的python。

但是当我运行测试应用程序时,我遇到了运行时错误。

Microsoft Visual C++ Runtime Library
Runtime Error!
program:E:\programming\delphi\p4dtest\dd\project1.exe

This application has requeste, the Runtime to terminate it in an unusual way.  
Please contact the application's support team for more information.

test.py:

import ctypes
print 'hello'

delphi app主要:

procedure TForm1.Button1Click(Sender: TObject);
begin
      PyExeFile('test.py', PE);    
end;

如果我删除“import ctypes”行,它运行正常,但如果导入ctypes则失败。

我用Google搜索并发现了一个问题: http//code.google.com/p/python4delphi/wiki/P4DPython26

根据文章,我编译res文件并将res文件和Microsoft.VC90.CRT.manifest甚至msvcr90.dll放在项目文件夹中,在项目文件中添加XP_UAC.RES,但我仍然收到错误。 然后我重新安装了Microsoft Visual C ++ 2008 SP1可再发行组件包,但似乎不是问题。 有没有人成功使用python2.6下的P4D,请告诉我如何制作它。

==================================
现在我通过阅读P4D官方网站上的问题解决了这个问题:

1、In the pythonengine property tab

‍keep set  “UseLastKnownVersion” to True

‍keep ‍set   "DLLName"  to  python26

2、on your PythonEngine component and adjust your define:

{$DEFINE PYTHON26}

which you can do in the project options of Delphi 7.  
Just add PYTHON26 to the "conditional defines" dialog box.

顺便说一下,我并不是要把我的每一个问题都弄糊涂,如果确实如此,我很抱歉,所以如果你没有自己尝试,请不要随意投入别人的问题。

我尝试了babykick的解决方案,但不断收到错误消息: 无法加载python25.dll

以下对我有用。 (delphi7,python26,windows xp sp3)

打开TPythonEngine属性选项卡并应用以下修改

  • DllName:python26.dll
  • DllPath:c:\\ windows \\ system32 \\
  • UseLastknownVersion:false

也许我没有清楚地描述我的问题。 现在我通过阅读P4D官方网站上的问题解决了这个问题:

1、In the pythonengine property tab

‍keep set  “UseLastKnownVersion” to True

‍keep ‍set   "DLLName"  to  python26

2、On your PythonEngine component and adjust your define:

{$DEFINE PYTHON26}

which you can do in the project options of Delphi 7.  
Just add PYTHON26 to the "conditional defines" dialog box  

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM