程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python: packaging tool nuitka

編輯:Python

brief introduction : Sometimes when we need to be without Python Environmental windows Computer runtime service , You need to generate .exe End of the file to execute .nuitka Pack fast , Start super fast , Support third-party libraries that are not needed in the project. You can choose not to package together , Reduce unnecessary bundling .

Related strategies :

python: py collect files exe Run the program independently

install :

pip install -i https://pypi.douban.com/simple nuitka

Source code of case :

# -*- coding: utf-8 -*-
# time: 2022/6/9 14:15
# file: main.py
# author: tom
# official account : Play with test development 
# -*- coding: utf-8 -*-
import datetime
print(datetime.datetime.now())

Click on pycharm Of Terminal Button , Enter the command to package the project :

nuitka --standalone --show-memory --show-progress --nofollow-imports --follow-import-to=utils,src --output-dir=out main.py

Parameter description :

--standalone: Easy to transplant to other machines , No more installation python
--show-memory --show-progress: Show the progress of the whole installation
--nofollow-imports: Do not compile all of the import
--follow-import-to=utils,src: It needs to be compiled into C++ The code specifies 2 A folder containing the source code , Here we use , To separate .
--output-dir=out: Specify the output result path as out.
--windows-disable-console: function exe Cancel the box .

Packing is done :

function :cmd - main.exe

WeChat official account : Play with test development
Welcome to your attention , Common progress , thank you !


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved