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