pip install selenium
抛出错误为:
Could not find a version that satisfies the requirement selenium;
No matching distribution found for selenium
请指导如何进行
最佳答案
这个错误信息...
Could not find a version that satisfies the requirement selenium;
No matching distribution found for selenium
...表示Python 客户端 无法安装Selenium 相关模块。
您的主要问题可能与 pip 版本或 Python 安装有关。
解决方案
- 卸载当前的 Python 安装。
- 因为您使用的是 Windows 7 专业操作系统,请使用 CCleaner用于在新安装 Python 客户端 之前清除所有操作系统杂务的工具。
- 下载并安装新版本的兼容 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
关于python - 找不到满足 Selenium 要求的版本;在 Python3.6.5 上安装 Selenium 时找不到与 selenium 匹配的分布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53702565/