关于sys.meta_path is None, Python is likely shutting down报错

时间:2024-03-16 10:41:13

运行报错:

Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.chrome.service.Service object at 0x015FA530>>
Traceback (most recent call last):
  File "C:\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 173, in __del__
  File "C:\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 149, in stop
  File "C:\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 120, in send_remote_shutdown_command

ImportError: sys.meta_path is None, Python is likely shutting down

1.网上查阅的方法是是说加quit就行了,其实这种方法治标不治本,每次 运行不加quit就会报错

原因分析:selenium版本和CHrome.chromedriver不匹配导致,每次Chromederiver调用chrome时后台都会打开一个Chromediver.

解决方法:1.卸载selenium ,PyCharm 2018.3.1\lib\site-packages下删除所有selenim开文件

关于sys.meta_path is None, Python is likely shutting down报错

2.删除C:\Users\Administrator\AppData\Local\Google\Chrome\Application下Chrome文件

关于sys.meta_path is None, Python is likely shutting down报错

3.重新安装selenium和Chromdriver对应的版本

我的Chrome版本 71.0.3578.98(正式版本) (64 位)

selenium版本Version: 3.141.0

Chromedriver版本v2.43

具体Chrome版本和Chromediver版本可参照对应表https://blog.csdn.net/huilan_same/article/details/51896672

Chromediver下载https://blog.csdn.net/huilan_same/article/details/51896672