我正在研究一些关于使用 python 和 selenium 的网络爬虫的知识,我最终发现了这个错误。
import pandas as pd
from bs4 import BeautifulSoup
from selenium import webdriver
driver = webdriver.Chrome(executable_path=r'C:\users\kaios\downloads\executable.exe')
driver.get('https://www.globo.com/')
错误代码:
C:\Users\kaios\Desktop\PONTO0\venv\Scripts\python.exe C:/Users/kaios/Desktop/PONTO0/furtarecipe.py
Traceback (most recent call last):
File "C:\Users\kaios\Desktop\PONTO0\furtarecipe.py", line 3, in <module>
from selenium import webdriver
File "C:\Users\kaios\Desktop\PONTO0\venv\lib\site-packages\selenium\webdriver\__init__.py", line 18, in <module>
from .firefox.webdriver import WebDriver as Firefox # noqa
File "C:\Users\kaios\Desktop\PONTO0\venv\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 31, in <module>
from .extension_connection import ExtensionConnection
File "C:\Users\kaios\Desktop\PONTO0\venv\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 25, in <module>
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
File "C:\Users\kaios\Desktop\PONTO0\venv\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 21, in <module>
from subprocess import Popen, STDOUT
ImportError: cannot import name 'Popen' from 'subprocess' (C:\Users\kaios\AppData\Local\Programs\Python\Python39\lib\subprocess.py)
Process finished with exit code 1