报错信息:
截图
代码
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库依赖,因此需要安装blinker
参考链接
https://github.com/seleniumbase/SeleniumBase/issues/2782