我是python的新开发人员 我想使用selenium web驱动程序api并使用mac pc和i安装Web驱动程序库
我在pycharm项目解释器安装代码'pip install web driver'但错误
错误定义请看:
Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/bin/python3.5'.
Could not find a version that satisfies the requirement webdriver (from versions: )
No matching distribution found for web driver
注意:我使用python 3.5但终端使用2.7 :(
找不到网络驱动程序的匹配分发
请帮助我
祝福......
答案 0 :(得分:4)
这个文档记录不是很清楚,但你不能从pypi安装webdriver但是需要安装selenium,然后它会给你webdriver。
sudo pip install selenium
应该做的伎俩。之后,像下面这样的事情应该有效:
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("https://stackoverflow.com/questions/34256762/error-could-not-find-a-version-that-satisfies-the-requirement-webdriver-from")
答案 1 :(得分:0)
您可以尝试以下方法,如果您不知道路径,请使用!apt installchrome-chromedriver
!pip install selenium
!pip install webdriver-manager
!apt-get update # to update ubuntu to correctly run apt install
!apt install chromium-chromedriver
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
import requests
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
wd = webdriver.Chrome('chromedriver',chrome_options=chrome_options)
driver =webdriver.Chrome('chromedriver',chrome_options=chrome_options)
答案 2 :(得分:0)
sudo python3 -m pip install selenium
仍然抛出错误:
收集硒找不到满足以下条件的版本 需求硒(来自版本:)没有匹配的分布 发现硒
我已经安装了Python2.7和3.5