第二十二节 单文件模式打包Playwright
打包示例源码下载:
请看文章末尾
版本信息:
playwright==1.28.0
pyinstaller==5.3
打包系统:
Windows 10
打包前我们要先运行下代码,确保没有报错:
# belle.py
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch(headless=False)
page = browser.new_page()
page.goto("https://pyqt5.blog.csdn.net/")
page.screenshot(path="test.png")
browser.close()
运行正常,成功打开了Chromium浏览器并截取了图片。
接着我们在cmd或者Powershell中尝试用以下命令开始打包:
pyinstaller belle.py