質問

私の環境は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 Main:

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

「インポート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再配分パッケージを再インストールしましたが、問題ではないようです。 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.

ちなみに、私は私の質問をみんなに混乱させるつもりはありません。もしそうなら、私はそれを申し訳ありませんので、あなたが自分で試していなければ、他の人の質問を任意に捧げないでください。

役に立ちましたか?

解決

たぶん私は私の質問をはっきりと説明していませんでした。今、私は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
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top