dawnzhu
V2EX  ›  问与答

pyppeteer 指定了 chrome 路径,运行程序还是会下载 chromium,求大佬指导

  •  
  •   dawnzhu · Jun 2, 2020 · 2478 views
    This topic created in 2181 days ago, the information mentioned may be changed or developed.
    import asyncio
    from pyppeteer import launch, executablePath
    from pyquery import PyQuery as pq
    
    
    async def main():
        browser = await launch(
            {executablePath: 'C:\\Users\\Administrator\\AppData\\Local\\pyppeteer\\chrome-win\\chrome.exe'})
        page = await browser.newPage()
        await page.goto('http://quotes.toscrape.com/js/')
        doc = pq(await page.content())
        print('Quotes:', doc('.quote').length)
        await browser.close()
    
    
    asyncio.get_event_loop().run_until_complete(main())
    

    运行程序会有以下提示

    [W:pyppeteer.chromium_downloader] start chromium download. Download may take a few minutes.

    我自己手动下载了 chromium,解压到了 pyppeteer 目录下,有大佬能指导下下吗 0. 0

    6 replies    2020-06-02 19:16:29 +08:00
    u823tg
        1
    u823tg  
       Jun 2, 2020
    Note: When you run pyppeteer first time, it downloads a recent version of Chromium (~100MB). If you don’t prefer this behavior, run pyppeteer-install command before running scripts which uses pyppeteer.

    大兄弟不看文档吗?
    u823tg
        3
    u823tg  
       Jun 2, 2020   ❤️ 1
    @gwy15 #2 这个我看 github 作者弃坑了。 感觉 python 这几年开坑弃坑的好多。。
    dawnzhu
        4
    dawnzhu  
    OP
       Jun 2, 2020
    我添加了路径的啊,谢谢大佬,我在看看
    dawnzhu
        5
    dawnzhu  
    OP
       Jun 2, 2020
    @u823tg 谢谢大佬,就是这个问题了,谢谢
    dawnzhu
        6
    dawnzhu  
    OP
       Jun 2, 2020
    @gwy15 按你文章说的解决了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2959 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 08:58 · PVG 16:58 · LAX 01:58 · JFK 04:58
    ♥ Do have faith in what you're doing.