问题记录 | PyLint not recognizing cv2 members
VScode中安装了pylint,总是提示cv2的一些成员函数找不到,
如这样的问题:
Module 'cv2' has no 'cvtColor' member
Module 'cv2' has no 'imread' member
类似Module 'cv2' has no '*' member
要我from cv2 import *
,可是这终究不是办法。
python中的opencv是通过以下命令安装的
pip install opencv-python
问题答案:
https://stackoverflow.com/questions/50612169/pylint-not-recognizing-cv2-members
pylint --generate-rcfile > .pylintrc
生成了.pylintrc文件
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code.
extension-pkg-whitelist=
然后在.pylintrc文件中加入cv2
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code.
extension-pkg-whitelist=cv2