Unresolved import selenium in python

好久不见. 提交于 2021-01-29 11:22:53

问题


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)

Any idea how to make it work?


回答1:


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.

An example of my configuration in Windows 10:

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

Pylint "unresolved import" error in visual studio code

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



来源:https://stackoverflow.com/questions/57490408/unresolved-import-selenium-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!