问题
Pylance works for .py
files:
But doesn't work with Jupyter .ipynb
notebooks:
I tried saving the .ipynb
- same issue.
How can enable Pylance warnings in my notebooks?
回答1:
Currently in VSCode, Python files use the code analysis and quick repair functions provided by the extension "Pylance", but Jupyter notebook does not use it.
Here is a workaround and you could refer to it: Please use "# %%
" in the ".py" file, it will separate the code like Jupyter and code parsing can be used.
回答2:
It seems that the Jupyter extension doesn't support Pylance.
I submitted this issue to address this shortcoming:
Pylance / Language server support #4307
来源:https://stackoverflow.com/questions/65561436/pylance-not-working-in-vscode-jupyter-notebooks