找不到满足硒要求的版本;在 Python3.6.5 上安装 Selenium 时找不到与 selenium 匹配的分布

新手上路,请多包涵
pip install selenium

抛出错误为:

 Could not find a version that satisfies the requirement selenium;
No matching distribution found for selenium

请指导如何进行

原文由 Tanushree Chandhok 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 722
1 个回答

这个错误信息…

 Could not find a version that satisfies the requirement selenium;
No matching distribution found for selenium

…暗示 Python 客户端 无法安装与 Selenium 相关的模块。

您的主要问题可能与 pip 版本或 Python 安装有关。

解决方案

  • 卸载当前的 Python 安装。
  • 由于您使用的是 _Windows 7 专业操作系统_,因此在新安装 Python Client 之前使用 CCleaner 工具清除所有操作系统杂务。
  • 下载并安装新版本的兼容 Python 3.6.5 二进制文件/可执行文件。
  • 确保您使用的是最新版本的 pip (最新版本 18.0 现已可用):
   C:\Users\username>python -m pip install --upgrade pip
  Collecting pip
    Downloading https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl (1.3MB)
      100% |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 1.3MB 544kB/s
  Installing collected packages: pip
    Found existing installation: pip 10.0.1
      Uninstalling pip-10.0.1:
        Successfully uninstalled pip-10.0.1
  Successfully installed pip-18.0

  • 安装最新版本的 Selenium
   C:\Users\username>pip install selenium
  Collecting selenium
    Downloading https://files.pythonhosted.org/packages/b8/53/9cafbb616d20c7624ff31bcabd82e5cc9823206267664e68aa8acdde4629/selenium-3.14.0-py2.py3-none-any.whl (898kB)
      100% |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 901kB 380kB/s
  Requirement not upgraded as not directly required: urllib3 in c:\python\lib\site-packages (from selenium) (1.22)
  Installing collected packages: selenium
    Found existing installation: selenium 3.12.0
      Uninstalling selenium-3.12.0:
        Successfully uninstalled selenium-3.12.0
  Successfully installed selenium-3.14.0

  • 或者:
   C:\Python35\Scripts\pip.exe install selenium

原文由 undetected Selenium 发布,翻译遵循 CC BY-SA 4.0 许可协议

推荐问题