Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the procedure for generating a dll-independent exe with Python

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Python does not rely on the exe generated by the operation of the steps is what kind of, I believe that many people do not have experience in this helpless, this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

1: Download Python Version 2.5.4 Source Code

2: Extract to F:\study\python\Python-2.5.4

3: Go to F:\study\python\Python-2.5.4\PCbuild8 and open the solution pcbuild.sln

Open F:\study\python\Python-2.5.4\PCbuild8\pcbuild.sln with vc 2005

4: Open the configuration properties of pcbuild solution and check the ones to be built, remove all of them, and only check the pythoncore project.

5: Change Code generation type to/MT in c/c++ configuration

6: Change the configuration type of pythoncore configuration properties to static lib

7: To implement static compilation embed Python generate dll independent exevc2005 + python 2.5.4 make a statically linked exe program, you need to change the output file of libray of pythoncore project active release to: $(OutDir)\python25.lib

8: Compile the project to generate F:\study\python\Python-2.5.4\PCbuild8\win32release\python25.lib

Above compiled a statically linked library python25.lib

9: Create a new solution F:\study\python\vc\test\test.sln

10: Add a file main.cpp

contents are as follows

#include #include int main() { Py_Initialize(); PyRun_SimpleString("print 'i am a static python exe!!! '"); Py_Finalize(); getchar(); return 0; } After reading the above content, do you know how to use Python to generate exe that does not depend on dll? If you still want to learn more skills or want to know more related content, welcome to pay attention to the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report