pyppeteer部署在centos7上出現的問題

1.error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory

  • 解決:安裝libXScrnSaver
yum install libXScrnSaver

2.pyppeteer.errors.NetworkError: Protocol error Emulation.setDeviceMetricsOverride: Target closed.

  • 解決:可以將依賴的websockets包改成6.0版本的
pip install websockets==6.0

3.pyppeteer Session closed. Most likely the page has been closed

注意:這個問題出現在websockets>6.0的情況,如果你的websockets版本是6.0則不會出現這種情況

  • 解決:
    到正在使用的python環境的site-packages尋找pyppeteer模塊,找到connection.py這個文件,找到按照如下網址修改:
    https://github.com/miyakogi/pyppeteer/pull/160/files
    即添加兩個參數 ping_interval=None, ping_timeout=None
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章