Python 皮佩蒂尔赢得';如果使用pyinstaller,则无法启动浏览器

Python 皮佩蒂尔赢得';如果使用pyinstaller,则无法启动浏览器,python,pyinstaller,pyppeteer,Python,Pyinstaller,Pyppeteer,出于某种原因,如果您使用Pyppeteer并尝试使用Pyinstaller构建它,它将无法工作 from pyppeteer import launch import asyncio async def browserLaunch(): browser = await launch(headless=False, handleSIGINT=False, handleSIGTERM=False, handleSIGHUP=False,

出于某种原因,如果您使用Pyppeteer并尝试使用Pyinstaller构建它,它将无法工作

from pyppeteer import launch
import asyncio


async def browserLaunch():
    browser = await launch(headless=False, handleSIGINT=False, handleSIGTERM=False, handleSIGHUP=False,
                           args=['--start-maximized'])
    page = (await browser.pages())[0]
    await page.goto("http://google.com")


asyncio.set_event_loop(asyncio.new_event_loop())
asyncio.get_event_loop().run_until_complete(browserLaunch())
现在,使用Pyinstaller将其构建到EXE中

pyinstaller --onefile -w BrowserTest.py
一旦启动可执行文件,就会出现“无法执行脚本”错误。让它工作的唯一方法是使用控制台构建它,或者禁用--onefile

pyinstaller --onefile BrowserTest.py

但是,同时使用“-w”和“-onefile”会导致脚本无法工作。我一直在互联网上搜索,没有找到答案,也问reddit r/learnpython,他们也没有找到解决方案。有什么想法吗

pyinstaller -w BrowserTest.py