python中未解决的导入硒 [英] Unresolved import selenium in python

查看:43
本文介绍了python中未解决的导入硒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚下载了 Visual Studio Code 并尝试运行一些 Python 代码.但是,当我尝试导入 Seleinum 时,我收到以下错误:

I have just downloaded Visual Studio Code and tried to run some Python code. However, when I try to import Seleinum I receive the following error:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

Erros:
module selenium
unresolved import 'selenium'Python(unresolved-import)
unresolved import 'selenium.webdriver.common.keys' Python(unresolved-import)

知道如何让它工作吗?

推荐答案

以下链接解决了您遇到的问题.您的工作区设置配置不正确.通过将虚拟环境库/包的 PATH 添加到工作区设置 settings.json 文件中,将更正该问题.

The links below address the issue you are having. Your workspace settings are improperly configured. By adding the PATH of the virtual environment library/packages to the workspace settings, settings.json, file will correct the issue.

我在 Windows 10 中的配置示例:

An example of my configuration in Windows 10:

"python.pythonPath": "C:\\Users\\UserName\\python-virtual-environments\\env\\lib",

Pylint未解析的导入"Visual Studio 代码中的错误

https://code.visualstudio.com/docs/getstarted/settings#_settings-file-locations

这篇关于python中未解决的导入硒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆