Pyinstaller 打包Python 成exe

安装: pip install pyinstaller 如果安装慢,可引用清华源: # 清华源 pip install pyinstaller -i https://pypi.tuna.tsinghua.edu.cn/simple/ cmd 切换到 python 文件的目录,执行命令: pyinstaller -F -w -i python.ico watermark.py 在dist 文件夹下,可以找到打包好的exe 文件 详细参数 在上面的打包命令中,用到了好几个参数:-F,-W,-i,这些参数的含义如下面的表格: 参数 用法 -F 生成结果是一个 exe 文件,所有的第三方依赖、资源和代码均被打包进该 exe 内 -D 生成结果是一个目录,各种第三方依赖、资源和 exe 同时存储在该目录(默认) -a 不包含unicode支持 -d 执行生成的 exe 时,会输出一些log,有助于查错 -w 不显示命令行窗口 -c 显示命令行窗口(默认) -p 指定额外的 import 路径,类似于使用 python path -i 指定图标 -v 显示版本号 -n 生成的 .exe 的文件名 pyinstaller -F -w -i python.ico watermark.py 就表示 -F,打包只生成一个 exe 文件,-w,在运行程序的时候不打打开命令行的窗口,-i 就是打包带有自己设置的 ico 图标。 ...

October 15, 2022 · Leon

Windows下 PyAutoGUI

PyAutoGUI 通过Python scripts自动控制鼠标和键盘的一系列操作来控制其它程序,已达到自动化(测试)目的。 安装方式, Windows上,可以使用py.exe 运行最新版本的Python: py -m pip install pyautogui 如果安装了多个版本的Python,需要指明版本号,如Python 3.8: py -3.8 -m pip install pyautogui 按键精灵实践, import pyautogui,time print(pyautogui.position()) while True: pyautogui.moveTo(960, 600, duration=1) # 移动到 (960,600) pyautogui.mouseUp() # 鼠标释放 pyautogui.click() # 鼠标当前位置点击一下 pyautogui.mouseUp() # 鼠标释放 time.sleep(238) pyautogui.mouseUp() # 鼠标释放 常用功能 ...

October 15, 2022 · Leon

python 替换 excel 特定内容

...

November 28, 2021 · Leon

速查小能手cheat.sh

写代码经常需要搜索一些命令、函数或者编程语言语法的问题,都可以通过其快速搜索而得到示例,小能手呀。 终端,使用 curl 即可启动: curl cheat.sh curl cht.sh 比如UNIX/Linux 命令: curl cheat.sh/tar curl cht.sh/curl curl https://cheat.sh/rsync curl https://cht.sh/tr 模糊查找,比如想查看如何建立快照,可使用~Keyword 的形式来查询: curl cht.sh/~snapshot 各种语言: curl cht.sh/go/Pointers curl cht.sh/scala/Functions curl cht.sh/python/lambda 具体支持语言列表用list查询: curl cht.sh/go/:list 各种问题解决方式,语言/问题描述: ...

November 20, 2021 · Leon

Win11 官方ISO 文件哈希值

建议Win11 直接从下面链接下载哈,当然也可以采用其它下载点。 https://www.microsoft.com/zh-cn/software-download/windows11 如果您想验证下载数据的完整性和真实性,请按照以下步骤操作: 下载所需产品 ISO 文件,并按照安装指南进行操作。 开启 Windows PowerShell。如果您需要查找操作系统中 PowerShell 的位置,请单击此处查看帮助。 在 PowerShell 中,使用 Get-FileHash cmdlet 计算您下载的 ISO 文件的哈希值。例如: Get-FileHash C:\Users\用户1\Downloads\Contoso8_1_ENT.iso ...

October 25, 2021 · Leon

WSL2下 Debian10 卸载docker

WSL2 尝试卸载dockers,发现一直报错,原因docker 这个服务已经停了,而无法卸载,尴尬 Removing docker-ce (5:20.10.7~3-0~debian-buster) ... invoke-rc.d: could not determine current runlevel [....] Stopping Docker: dockerstart-stop-daemon: warning: failed to kill 2160: No such process No process in pidfile '/var/run/docker-ssd.pid' found running; none killed. invoke-rc.d: initscript docker, action "stop" failed. dpkg: error processing package docker-ce (--remove): installed docker-ce package pre-removal script subprocess returned error exit status 1 dpkg: error while cleaning up: installed docker-ce package post-installation script subprocess returned error exit status 1 dpkg: docker-ce-cli: dependency problems, but removing anyway as you requested: docker-ce depends on docker-ce-cli. Removing docker-ce-cli (5:20.10.7~3-0~debian-buster) ... Errors were encountered while processing: docker-ce E: Sub-process /usr/bin/dpkg returned an error code (1) 可以看到 invoke-rc.d: could not determine current runlevel ,查看docker-ce.prerm ...

June 26, 2021 · Leon