问题展开目录
在使用
1 | pyinstaller |
1 | playwright |
1 | playwright |
原理展开目录
其实解决这个问题,就要利用
1 | playwright |
1 | PLAYWRIGHT_BROWSERS_PATH |
1 | playwright |
1 | playwright install |
1 | 0 |
1 | python |
1 | /site-packages/playwright/driver/package/.local-browsers |
1 | pyinstaller |
解决展开目录
方法一
修改 python 代码,使其读取绝对路径下的浏览器 (不打包进程序)
os.environ['PLAYWRIGHT_BROWSERS_PATH'] = "C:/playwright/"# 将其修改为绝对路径
方法二展开目录
修改环境变量,将浏览器安装进 python 内置目录
# powershell $env:PLAYWRIGHT_BROWSERS_PATH="0" # Linux export PLAYWRIGHT_BROWSERS_PATH="0" # cmd set PLAYWRIGHT_BROWSERS_PATH="0" # finally playwright install
总结展开目录
如果
1 | playwright |
Comments | NOTHING