我在 VSCode 上以交互模式运行 Python 3.9.5。我的第一个单元格如下所示:
错误是
标记“” Pylance 中的无效字符
.
当我按下 Run Cell 时,代码仍然运行良好。
我怎样才能让 Pylance 忽略这些命令或以某种方式摆脱错误?
扩展:
- Pylance 1021.5.1
- 蟒蛇 2021.5.829140558
- Jupyter 2021.5.745244803
操作系统:Windows 10
我在 VSCode 上以交互模式运行 Python 3.9.5。我的第一个单元格如下所示:
错误是
标记“” Pylance 中的无效字符
.
当我按下 Run Cell 时,代码仍然运行良好。
我怎样才能让 Pylance 忽略这些命令或以某种方式摆脱错误?
扩展:
操作系统:Windows 10
这将报告为警告:
!pip install numpy
这将迫使 Pylance 忽略该行中的警告
!pip install numpy # type: ignore
如果您只有几行,这没关系,但理想情况下,我希望有一个注释/注释来禁用 linter,然后另一个注释/注释来重新启用它,但我不知道该怎么做那,也许是这样的:
# type: ignore on <<<<<<<<<< NOTE: THIS DOES NOT WORK, I JUST WISH IT DID
!pip install numpy
!pip install matplotlib
!pip install pandas
# type: ignore off <<<<<<<<<< NOTE: THIS DOES NOT WORK, I JUST WISH IT DID