python-3.x - 由于 ModuleNotFoundError : No module named 'webdriver_manager' Ubuntu Python,无法运行运行脚本

标签 python-3.x ubuntu selenium-webdriver firefox jupyter-notebook

我正在使用 anaconda、jupyter 并安装了 pip 和 pip3 webdriver_manager,但当我尝试运行 python3 代码时,我不断收到此错误。当我在终端中运行代码时

$ pip install webdriver_manager
Collecting webdriver_manager
  Using cached https://files.pythonhosted.org/packages/dd/3c/2e2d71aeb28ee73ecaf12b545542b082ca81c8c091bb05028c52c42696ce/webdriver_manager-2.4.0-py2.py3-none-any.whl
Collecting requests (from webdriver_manager)
  Using cached https://files.pythonhosted.org/packages/45/1e/0c169c6a5381e241ba7404532c16a21d86ab872c9bed8bdcd4c423954103/requests-2.24.0-py2.py3-none-any.whl
Collecting configparser (from webdriver_manager)
  Using cached https://files.pythonhosted.org/packages/7a/2a/95ed0501cf5d8709490b1d3a3f9b5cf340da6c433f896bbe9ce08dbe6785/configparser-4.0.2-py2.py3-none-any.whl
Collecting crayons (from webdriver_manager)
  Using cached https://files.pythonhosted.org/packages/5b/0d/e3fad4ca1de8e70e06444e7d777a5984261e1db98758b5be3e8296c03fe9/crayons-0.4.0-py2.py3-none-any.whl
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests->webdriver_manager)
  Using cached https://files.pythonhosted.org/packages/9f/f0/a391d1463ebb1b233795cabfc0ef38d3db4442339de68f847026199e69d7/urllib3-1.25.10-py2.py3-none-any.whl
Collecting chardet<4,>=3.0.2 (from requests->webdriver_manager)
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests->webdriver_manager)
  Using cached https://files.pythonhosted.org/packages/5e/c4/6c4fe722df5343c33226f0b4e0bb042e4dc13483228b4718baf286f86d87/certifi-2020.6.20-py2.py3-none-any.whl
Collecting idna<3,>=2.5 (from requests->webdriver_manager)
  Using cached https://files.pythonhosted.org/packages/a2/38/928ddce2273eaa564f6f50de919327bf3a00f091b5baba8dfa9460f3a8a8/idna-2.10-py2.py3-none-any.whl
Collecting colorama (from crayons->webdriver_manager)
  Using cached https://files.pythonhosted.org/packages/c9/dc/45cdef1b4d119eb96316b3117e6d5708a08029992b2fee2c143c7a0a5cc5/colorama-0.4.3-py2.py3-none-any.whl
Installing collected packages: urllib3, chardet, certifi, idna, requests, configparser, colorama, crayons, webdriver-manager
Successfully installed certifi-2020.6.20 chardet-3.0.4 colorama-0.4.3 configparser-4.0.2 crayons-0.4.0 idna-2.10 requests-2.24.0 urllib3-1.25.10 webdriver-manager-2.4.0

在我的 IDE 中,我得到以下输出

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from time import sleep
import requests
from selenium.webdriver.firefox.options import Options as FirefoxOptions
from webdriver_manager.firefox import GeckoDriverManager

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-3-87a373070a15> in <module>
      9 import requests
     10 from selenium.webdriver.firefox.options import Options as FirefoxOptions
---> 11 from webdriver_manager.firefox import GeckoDriverManager

ModuleNotFoundError: No module named 'webdriver_manager'

我一直在尝试发布在 SO 上的几种解决方案,但没有一个能解决问题

最佳答案

我也遇到了同样的问题。就我而言,解决方案是 python3.8 -m pip install webdriver_manager 现在它可以工作了

关于python-3.x - 由于 ModuleNotFoundError : No module named 'webdriver_manager' Ubuntu Python,无法运行运行脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64095970/

相关文章:

python-3.x - 在python函数中返回数据框

python - 获取列表中的所有非唯一元素

python-3.x - 当我们使用 Django(现有项目)进行身份验证并使用 FastAPI(新功能)进行 API 时,如何识别并保存正确的 "user"?

php - 在 ubuntu 上构建 php5.3.8,得到错误 : configure: error: Unable to locate gmp. h

c - 从应用程序 makefile 运行库 makefile

java - 使用 Selenium 如何获取网络请求

java - 使用 cssSelector 或 xPath Selenium Web 驱动程序在过滤器上应用按钮?

python - 如何在循环中无延迟地刷新 Tkinter 显示

python - 在 ubuntu 上将 python 包关联到不同版本的 python

java - 如何在Appium中获取和存储列表数据以及如何点击特定的搜索记录