[英]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”的安装:
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 终端,它会自动进入选择的环境。)
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.