简体   繁体   English

无法导入 selenium,即使我在 vscode 中安装了 python 和 pip

[英]not able to import selenium, even though I have python and pip installed in vscode

Even though I have Python installed and can confirm it in the command prompt.即使我安装了 Python 并且可以在命令提示符下确认它。 在此处输入图像描述

VSCode also shows the python installed VSCode 还显示安装了 python

在此处输入图像描述

Also I have pip installed in the very same location我还在同一个位置安装了 pip 在此处输入图像描述

still when I run do import selenium I'm getting this error仍然当我运行时导入 selenium 我收到此错误在此处输入图像描述

Not sure what am I missing?不知道我错过了什么?

For using selenium in chrome you have to download selenium chrome driver not selenium.要在 chrome 中使用 selenium,您必须下载 selenium chrome 驱动程序而不是 selenium。 So, download the selenium chrome driver from below link & Include path in code.因此,请从以下链接下载 selenium chrome 驱动程序并在代码中包含路径。 Note that, You have latest version of chrome请注意,您拥有最新版本的 chrome

[link] https://chromedriver.chromium.org/downloads [链接] https://chromedriver.chromium.org/downloads

After downloading include path in code like this在这样的代码中下载包含路径后

driver = webdriver.Chrome(executable_path="C:\\chromedriver.exe")

Please refer to the following to check the installation of the module "selenium":请参考以下检查模块“selenium”的安装:

  1. Please use the command " pip --version " to check whether the source of the module installation tool "pip" is the same as the python displayed in the lower left corner of VS Code: (If they are different, please use the shortcut key Ctrl+Shift+` to open a new VS Code terminal, and it will automatically enter the selected environment.)请使用命令“ pip --version ”检查模块安装工具“pip”的来源是否与VS Code左下角显示的python相同:(如果不同,请使用快捷键Ctrl+Shift+` 打开一个新的 VS Code 终端,它会自动进入选择的环境。)

    在此处输入图像描述

  2. After the installation is completed in the selected environment, we can use " pip show selenium " to check its installation location: ..:\lib\site-packages在选择的环境下安装完成后,我们可以使用“ pip show selenium ”查看它的安装位置: ..:\lib\site-packages

    在此处输入图像描述

Run:跑:

在此处输入图像描述

Reference: Python environment in VS Code .参考: VS Code 中的 Python 环境

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我已经从selenium import webdriver ImportError收到此错误:即使我已经安装了selenium模块,也没有名为selenium的模块。 - i have getting this error 'from selenium import webdriver ImportError: No module named selenium" even though i have installed selenium module Pip 即使我下载了 python 也显示未安装? - Pip showing up an not installed even though I downloaded python? 即使我安装了 pip,Matplotlib 也无法在 python 中工作 - Matplotlib won't work in python even though i pip installed it 即使已安装pip并将其添加到PATH,也无法执行pip命令 - Not able to execute pip commands even though pip is installed and added to PATH Python 无法导入包,即使它是通过 pip 安装的 - Python can't import packages even though its installed via pip 即使 pip 说它已安装,Python 也无法导入 gdal - ubuntu hirsute & impish specific - Python can't import gdal even though pip says it's installed - ubuntu hirsute & impish specific 无法在虚拟环境中导入'flask_wtf'和'wtforms',即使我已经安装了它们? - Unable to import 'flask_wtf' & 'wtforms' in a virtual env even though I've already pip installed them? 终端输出:Python 2.7.16 即使我安装了 3.8.2 - Terminal outputting: Python 2.7.16 Even though I have 3.8.2 installed Python 无法导入“nbt”,即使已安装 - Python Unable to import 'nbt' even though it is installed 为什么'pip'需要“setuptools> = 0.8”,即使我安装了2.1? - Why does 'pip' require “setuptools >= 0.8” even though I have 2.1 installed?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM