Vscode Django 报错Class 'xxx' has no 'objects' member

背景:pycharm写django时,有些自己写的小测lai试被pycharm认为是Pytest跑起来有点麻烦,故使用vscode

原因:pylint语法检查器报错,pylint是静态检查,在用第三方库的时候有些成员只有在运行代码的时候才会被建立,它就找不到成员

最新版Vscode解决:更改pylint选项 

记得之前先装pylint-django   

pip install pylint-django

I've tried all possible solutions offered but unluckly my vscode settings won't changed its linter path. So, I tride to explore vscode settings in settings > User Settings > python. Find Linting: Pylint Path and change it to "pylint_django". Don't forget to change the linter to "pylint_django" at settings > User Settings > python configuration from "pyLint" to "pylint_django".

解决链接:

https://stackoverflow.com/questions/45135263/class-has-no-objects-member

(csdn传个图这么南气死我了)

猜你喜欢

转载自blog.csdn.net/houn27/article/details/103947245