python-3.x - 如何让 pylint 在 VS Code 中使用 python 3?

标签 python-3.x python-2.7 debugging visual-studio-code pylint

我希望 pylint 在 Mac 上的 Visual Studio 代码(同时具有 python 2.7 标准和 python 3.6)中使用 python3 进行 linting。

我尝试按照 How can I debug Python3 code in Visual Studio Code 更改 python 解释器的路径,无济于事。我不断收到 python2 错误而不是 python3 错误。

参见example code对于这个问题。

有没有办法让 pylint 识别 python3 错误?

最佳答案

  1. 在 Visual Studio Coce(VSC) 中选择一个 xx.py
  2. 在状态栏中点击 Python 2.7.10,例如 [img1]
  3. 选择 python 3.x,如 [img2]
  4. Command+Q 退出 VSC,然后再次打开 VSC

enter image description here

img2

关于python-3.x - 如何让 pylint 在 VS Code 中使用 python 3?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47635573/

相关文章:

python - 从列表中删除不需要的字符

Python3 : Does the built-in function "map" have a bug?

python - 在没有基于模型的数据库的情况下使用 Django View 和表单

python - 从子目录调用 python 脚本(使用子进程调用 grep)导致错误

debugging - Windbg:如何获取符号的源文件名?

python - 确保 urlpatterns 是 path() 和/或 re_path() 实例的列表

python - 如何使已打开的文件可读(例如 sys.stdout)?

python - 如何使用 Kivy 获取 textinput 的值

javascript - 如何在 Chrome DevTools 中中断 document.write?

c - 处理器如何知道断点?