本帖最后由 louis16s 于 2022-3-9 13:05 编辑
【3.9更新】python3.7下打包会出现问题,更新版本即可截止到我写下这个文章的时候
仅有一个中文网站转载了GitHub上
playwright issue里面的一个教程,但是并不好用
最后我在playwright官方文档下找到了方法
[Python] 纯文本查看 复制代码 from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto("http://whatsmyuseragent.org/")
page.screenshot(path="example.png")
browser.close()
在cmd中输入如下代码
[Bash shell] 纯文本查看 复制代码 set PLAYWRIGHT_BROWSERS_PATH=0playwright install chromium
pyinstaller -F main.py
又或者是powershell
[PowerShell] 纯文本查看 复制代码 $env:PLAYWRIGHT_BROWSERS_PATH="0"playwright install chromium
pyinstaller -F main.py |