ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

Python从入门到放弃 (二) 将.py文件转化为win 10下的可执行程序

2021-12-26 11:58:32  阅读:186  来源: 互联网

标签:10 Hello pyinstaller script Python py options folder 可执行程序


一.Pyinstaller库的简介

该第三方库的作用就是把用python语言编写的程序转化为在windows环境下可执行程序.exe文件

官方地址见下面:

Features — PyInstaller bundles Python applicationshttp://www.pyinstaller.org/features.html

二.Pyinstaller库的安装

在[cmd]界面中输入 pip3 install Pyinstaller 即可安装此库如下图所示,笔者已经安装好了。

三.Pyinstaller库的使用

1.指令原型

pyinstaller [options] script [script …] | specfile

说明:

  • Writes myscript.spec in the same folder as the script.

  • Creates a folder build in the same folder as the script if it does not exist.

  • Writes some log files and working files in the build folder.

  • Creates a folder dist in the same folder as the script if it does not exist.

  • Writes the myscript executable folder in the dist folder

下列举例说明两种转化你的.py文件的用法。假设你在D盘建立了Hello.py这个程序

那么该文件地址为 D:\Hello.py  按照下面的例子来写,其中options要看具体的说明

pyinstaller options… ~/myproject/source/myscript.py

pyinstaller options… ~D:\Hello.py

另一种用法

pyinstaller "C:\Documents and Settings\project\myscript.spec"

pyinstaller "D:\Hello.py"这个简单直接。笔者写了一个简单的输入姓名的程序name.py,转化后就是文件类型为 Compiled Python File,可以直接在windows上运行。

2.OPTIONS 指令下选项说明见我的下一篇文章

标签:10,Hello,pyinstaller,script,Python,py,options,folder,可执行程序
来源: https://blog.csdn.net/sunny00544/article/details/122118749

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有