解决ModuleNotFoundError:寻找名为‘blinker._saferef’的模块

环境描述:

 我这里用的Python 3.12.2,selenium_wire==5.1.0

报错信息:

截图

代码

File "D:\Code\Python\flask-api\.venv\Lib\site-packages\seleniumwire\webdriver.py", line 28, in <module>
    from seleniumwire import backend, utils
  File "D:\Code\Python\flask-api\.venv\Lib\site-packages\seleniumwire\backend.py", line 4, in <module>
    from seleniumwire.server import MitmProxy
  File "D:\Code\Python\flask-api\.venv\Lib\site-packages\seleniumwire\server.py", line 5, in <module>
    from seleniumwire.handler import InterceptRequestHandler
  File "D:\Code\Python\flask-api\.venv\Lib\site-packages\seleniumwire\handler.py", line 5, in <module>
    from seleniumwire import har
  File "D:\Code\Python\flask-api\.venv\Lib\site-packages\seleniumwire\har.py", line 11, in <module>
    from seleniumwire.thirdparty.mitmproxy import connections
  File "D:\Code\Python\flask-api\.venv\Lib\site-packages\seleniumwire\thirdparty\mitmproxy\connections.py", line 10, in <module>
    from seleniumwire.thirdparty.mitmproxy.net import tls, tcp
  File "D:\Code\Python\flask-api\.venv\Lib\site-packages\seleniumwire\thirdparty\mitmproxy\net\tls.py", line 15, in <module>
    import seleniumwire.thirdparty.mitmproxy.options
  File "D:\Code\Python\flask-api\.venv\Lib\site-packages\seleniumwire\thirdparty\mitmproxy\options.py", line 5, in <module>
    from seleniumwire.thirdparty.mitmproxy import optmanager
  File "D:\Code\Python\flask-api\.venv\Lib\site-packages\seleniumwire\thirdparty\mitmproxy\optmanager.py", line 9, in <module>
    import blinker._saferef
ModuleNotFoundError: No module named 'blinker._saferef'

解决办法:

pip install blinker==1.7.0

错误分析:

selenium-wire缺少blinker==1.7.0库依赖,因此需要安装blinker==1.7.0 

参考链接

https://github.com/seleniumbase/SeleniumBase/issues/2782

作者:weixin_41934979

物联沃分享整理
物联沃-IOTWORD物联网 » 解决ModuleNotFoundError:寻找名为‘blinker._saferef’的模块

发表回复