我无法在python2.6下使用python for delphi

发布于 2024-10-22 12:16:22 字数 1497 浏览 5 评论 0原文

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

但是当我运行测试应用程序时,出现运行时错误。

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:delphi

import ctypes
print 'hello'

app main:

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

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

我用谷歌搜索并发现了一个关于此的问题: http://code.google.com/p/python4delphi/wiki/P4DPython26

根据文章,我编译了res文件,并将res文件和Microsoft.VC90.CRT.manifest甚至msvcr90.dll放在项目文件夹中,在项目文件中添加XP_UAC.RES,但仍然出现错误。 然后我重新安装了Microsoft Visual C++ 2008 SP1 Redistributable Package,但似乎不是问题。 有人在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.

顺便说一句,我并不是故意让大家困惑我的问题,如果是的话,我很抱歉,所以请不要'自己没有尝试过就不要随意提出别人的问题。

My environment is delphi7 and Python2.6.6, python for delphi installed.

But when I run a test app, I got a runtime error.

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 main:

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

It runs ok if I remove the line "import ctypes", but failed if ctypes is imported.

I googled and found an issue on this:
http://code.google.com/p/python4delphi/wiki/P4DPython26.

According to the article, I compile the res file and put the res file and Microsoft.VC90.CRT.manifest even msvcr90.dll in the project folder, add XP_UAC.RES in the project file, but I still got the error.
Then I reinstalled the Microsoft Visual C++ 2008 SP1 Redistributable Package, but it seems not the problem.
Did anyone use the P4D under python2.6 successfully, please tell me how I can make it.

==================================
Now i have solved the ploblem by myself through reading the issues on the official website of 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.

By the way, I don't mean to confuse everyone of my question, if it does, I'm sorry for that, so please don't devote others' question arbitrarily if you didn't try by yourself.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

萌逼全场 2024-10-29 12:16:22

也许我没有清楚地描述我的问题。
现在我通过阅读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  

Maybe I did't describe my question clearly.
Now i have solved the ploblem by myself through reading the issues on the official website of 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  
心房敞 2024-10-29 12:16:22

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

以下内容对我有用。 (delphi7、python26、windows xp sp3)

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

  • DLL名称:python26.dll
  • DllPath:c:\windows\system32\
  • UseLastknownVersion:假

I tried the solution of babykick, but kept getting the error message:
can't load python25.dll

The following worked for me. (delphi7, python26, windows xp sp3)

Open the TPythonEngine property tab and apply the
following modifications

  • DllName : python26.dll
  • DllPath : c:\windows\system32\
  • UseLastknownVersion : false
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文