python打包成apk界面设计_Stephen的SEM博客
首先電腦安裝python 可執行文件 且添加到環境變量
下載網址如下
第二步? 使用命令行
第三部 使用pip安裝軟件包 pyinstaller
輸入cmd 然后輸入
pip install pyinstaller
第4部 保存py文件
以下是樣本文件 py,保存為hello.py
import tkinter as tk
root= tk.Tk()
canvas1 = tk.Canvas(root, width = 300, height = 300)
canvas1.pack()
def hello ():
label1 = tk.Label(root, text= 'Hello World!', fg='green', font=('helvetica', 12, 'bold'))
canvas1.create_window(150, 200, window=label1)
button1 = tk.Button(text='Click Me',command=hello, bg='brown',fg='white')
canvas1.create_window(150, 150, window=button1)
root.mainloop()
然后把文件保存下面路徑
C:\Users\Ron\Desktop\MyPython
這個文件命名為hello.py
第5步 使用pyinstaller 制作exe文件
使用cmd命令 進入文件路徑
cd C:\Users\Ron\Desktop\MyPython
使用pystaller命令生成
pyinstaller --onefile pythonScriptName.py
根據上面文件的命名規則 這里使用hello,如下
pyinstaller --onefile hello.py
然后按回車
第6部 執行exe文件
可以在? dist?文件夾下看到
hello變成了exe文件
當你點擊后 就會執行程序
因為我們的代碼是輸出hello world 就變成如下了
總結
以上是生活随笔為你收集整理的python打包成apk界面设计_Stephen的SEM博客的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: custompage.width 不能小
- 下一篇: python函数太多_numpy Loa