I've just started using Pyright. Running it on files that run perfectly well I get plenty of errors.
This question is similar, but refers to one's own modules.
For example Import "numpy" could not be resolved
. What does it mean, and how do I resolve it?
On my computer I have 3 Pythons, a 3.6 from Anaconda, and a 2.7 & 3.7 that are regular python. Prompted by a nudge from this GH issue, I switched from the Anaconda 3.6 to the 3.7, and back again, and the problem went away.
I think that this is the case because your .vscode/settings.json
(the following is mine), doesn't have that last line until you change your python, at which point, that last line is put in and Pyright has something to look at.
{
"python.linting.enabled": true,
"python.formatting.provider": "black",
"python.pythonPath": "C:\\Users\\ben\\Anaconda3\\python.exe"
}
python -m pip install -U pylint
python -m pip install --upgrade pip
Open VS Code -> CTRL + SHIFT P
-> Search 'select linter
' [Python: Select Linter
] -> Hit Enter and Select Pylint
If not solved.
Try deactivate
your environment pip install numpy
in your global environment.
And if you are using Local Environment getting unresolved imports error then add In .vscode/settings.json "python.analysis.extraPaths": ["./path-to-your-code"],
for example "python.analysis.extraPaths": [ "*.lib" ]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With