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:

import ctypes
print 'hello'

Delphi アプリのメイン:

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.

ところで、私の質問で皆さんを混乱させるつもりはありませんが、混乱してしまった場合は申し訳ありませんので、自分で試したのでなければ勝手に他人の質問をあてにしないでください。

4

2 に答える 2

1

多分私は私の質問を明確に説明していませんでした。P4Dの公式Webサイトの問題を読んで、問題を自分で解決しました。

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  
于 2011-03-18T05:32:22.123 に答える
1

babykickの解決策を試しましたが、エラー メッセージが表示され続けました: can't load python25.dll

以下は私のために働いた。(delphi7、python26、Windows XP SP3)

TPythonEngine プロパティ タブを開き、次の変更を適用します。

  • DllName : python26.dll
  • DllPath : c:\windows\system32\
  • UseLastknownVersion : false
于 2012-06-10T10:04:59.200 に答える