【PyCharm编辑器-转载】之引用selenium包提示错误:Unresolved reference 'selenium' less... (Ctrl+F1)

一.现象还原:

当新建.py文件时,需要引用selenium中的方法时,报错,提示红波浪线:

Unresolved reference ‘selenium’ less… (Ctrl+F1)
This inspection detects names that should resolve but don’t. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items.

二.解决办法:

1.点击编辑器“File”->点击“settings”

2.在“settings”中,选择“Project:Pytest”->“Project Structre”->点击“Add Content Root”

3.找到安装selenium的路径,红色字体(例:F:\软件\python3.6.1\Lib\site-packages),最后点击【OK】!
【PyCharm编辑器-转载】之引用selenium包提示错误:Unresolved reference 'selenium' less... (Ctrl+F1)_第1张图片

4.选择selenium包的路径,再点击“Sources”

5.最后再“Apply”应用,再返回.py文件中就不会再提示错误了。

如转载本文,关注博主的博客:Owen_ET,https://www.cnblogs.com/Owen-ET/

你可能感兴趣的:(【PyCharm编辑器-转载】之引用selenium包提示错误:Unresolved reference 'selenium' less... (Ctrl+F1))