python - ModuleNotFoundError:没有名为“selenium”的模块,jupyter notebooks python 参考
问题描述
我真的只是想用python打开一个网页。我认为问题在于 Jupyter 笔记本使用的 python 版本与存储 selenium 的版本不同,但我不确定当我从 Jupyter 笔记本安装 selenium 时这怎么可能。我将在下面提供更多详细信息。
我的示例代码很无聊:
from selenium import webdriver
driver = webdriver.chrome()
driver.get('http://python.org')
这当然给出了标题中的错误。我的操作系统是 Linux,发行版是 Linux Mint。终端说我有 Python 2.7.17,pip 是 9.0.1 版(python 2.7)。
尝试通过运行安装 selenium
!pip2 install selenium
在路径 /home/frogsnakeman/.local/lib/python2.7/site-packages 中给出“selenium”和“selenium-3.141.0 dist-info”文件夹(我的用户是 frogsnakeman :P)
然而,输入
from platform import python_version
print(python_version())
返回 3.6.9。
解决方案
要检查您安装的库,您可以使用pip freeze
;
要检查您是否可以使用两个以上的 python 版本,wich python
并且在键入选项卡之后,所有可用版本都会为您显示。
推荐阅读
- java - 是否可以设置 Jackson 以将未命名的包装器对象排除到 API 返回的 JSON 数组中?
- c# - 从 Mat 的特定值创建蒙版(在 EMGU 中)
- android - 为什么 child.layout() 的第三个和第四个参数都带有前缀?
- arrays - 在 react-quiz-component 依赖中控制 questionPic 的大小?
- c# - C# 将 if 检查添加到代码块(我没有经验,需要帮助)
- android - 多层建筑中的空间定位,无需在建筑物中安装传感器
- android - 用于 android 的 ML-Kit 人脸检测是否支持 GPU 加速?
- docker - 如何在 WSL + Docker + VS Code 设置中防止用户冲突
- github-codereviews - 要求审查全同态加密库
- apache-flink - Apache flink 从后期窗口访问键控状态