A simple program:
# Include "Boost/python. HPP "</P> <p> int _ tmain (INT argc, _ tchar * argv []) <br/>{< br/> py_initialize (); <br/> pyrun_simplestring ("Print 'hello'"); <br/> py_finalize (); <br/> system ("pause"); <br/> return 0; <br/>}< br/>
No problem. But I still cannot run it in an XP environment (XP is in a virtual machine, except that the driver is not installed in msdn ). I have installed vc2005 Runtime Library in XP, python26.dll, boost_python-vc80-mt-1_39.dll, boost_python-vc80-mt-gd-1_39.dll are copied to the directory where the program is located or not. The program is released by release. The prompt is displayed as soon as you run the command:
Application initialization (0xc0150002) fails. Click OK to terminate the application.
Google was fruitless for half a day.
This morning, I ran a python program packaged in py2exe under xp. Because it is for2.6, We need to install the Runtime Library of vc2008, I ran the C ++ applet yesterday.
But there are still errors. After I pack py2exeand then decompress library.zip to complete the operation! I used python to access the database in C ++, and the operation was also okay!
It seems that it is better to embed Python C ++ programs in the future without vc8 writing. Just use pure C ++.
PS: If it is packaged with py2exe, manually redist/x86/Microsoft. vc90.crt under vs2008 during release
Copy the following four files to the DIST directory generated by py2exe package.
The Dist directory is running in any environment where Python or 08 Runtime Library is not installed.