V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
dawnzhu
V2EX  ›  问与答

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

  •  
  •   dawnzhu · 2020-06-02 18:05:37 +08:00 · 1648 次点击
    这是一个创建于 1428 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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 条回复    2020-06-02 19:16:29 +08:00
    u823tg
        1
    u823tg  
       2020-06-02 18:32:32 +08:00
    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  
       2020-06-02 18:41:27 +08:00   ❤️ 1
    @gwy15 #2 这个我看 github 作者弃坑了。 感觉 python 这几年开坑弃坑的好多。。
    dawnzhu
        4
    dawnzhu  
    OP
       2020-06-02 19:10:35 +08:00
    我添加了路径的啊,谢谢大佬,我在看看
    dawnzhu
        5
    dawnzhu  
    OP
       2020-06-02 19:14:21 +08:00
    @u823tg 谢谢大佬,就是这个问题了,谢谢
    dawnzhu
        6
    dawnzhu  
    OP
       2020-06-02 19:16:29 +08:00
    @gwy15 按你文章说的解决了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2211 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 16:00 · PVG 00:00 · LAX 09:00 · JFK 12:00
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.