You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VSCode中Pylint无输出问题求助,需配置默认bash终端并实现保存时自动Linting

Fixing Pylint Not Working in VSCode + Setting Default Terminal to Bash

Let’s tackle your issues step by step—first getting your default terminal set to bash, then making sure Pylint works reliably in VSCode (especially when you save files).

Step 1: Set Default Terminal to WSL Bash

Since you’re using WSL, we’ll configure VSCode to launch bash by default whenever you open a terminal. Add these settings to your settings.json:

"terminal.integrated.defaultProfile.windows": "WSL Bash",
"terminal.integrated.profiles.windows": {
    "WSL Bash": {
        "path": "C:\\WINDOWS\\System32\\wsl.exe",
        "args": []
    }
}

This ensures bash is your go-to terminal in VSCode.

Step 2: Fix Pylint Not Showing Results

The root issue here is likely a mismatch between the Python environment VSCode uses and the one where Pylint is installed (you confirmed Pylint works in your bash terminal, but VSCode might be pointing to a different Python instance). Here’s how to align them:

This is the simplest way to keep your terminal and VSCode environment in sync:

  1. Install the Remote - WSL extension in VSCode.
  2. Click the green icon in the bottom-left corner of VSCode, then select "New WSL Window" to open your project in the WSL context. This will automatically use your WSL Python and Pylint setup.

Option 2: Manually Configure Paths

If you prefer not to use the Remote extension, update your settings.json to point to your WSL Python and Pylint:

  • Run which python3 and which pylint in your bash terminal to get their full paths.
  • Add these paths to your settings:
    "python.pythonPath": "\\\\wsl$\\Ubuntu\\home\\becky\\.local\\bin\\python3", // Adjust to your actual path
    "python.linting.pylintPath": "\\\\wsl$\\Ubuntu\\home\\becky\\.local\\bin\\pylint" // Adjust to your actual path
    

Then enable linting on save:

"python.linting.run": "onSave"

Step 3: Full Working settings.json

Here’s a cleaned-up, complete configuration that combines all fixes, with comments for clarity:

{
    // Default terminal setup (WSL Bash)
    "terminal.integrated.defaultProfile.windows": "WSL Bash",
    "terminal.integrated.profiles.windows": {
        "WSL Bash": {
            "path": "C:\\WINDOWS\\System32\\wsl.exe",
            "args": []
        }
    },
    // Linting configuration
    "python.linting.enabled": true,
    "python.linting.pylintEnabled": true,
    "python.linting.pylintUseMinimalCheckers": false,
    "python.linting.run": "onSave", // Trigger linting when saving files
    // WSL Python interpreter path (adjust to match your setup)
    "python.pythonPath": "\\\\wsl$\\Ubuntu\\home\\becky\\.local\\bin\\python3",
    // Your existing preferences
    "git.confirmSync": false,
    "window.zoomLevel": -2,
    "files.autoSave": "off",
    "workbench.editorAssociations": [
        {
            "viewType": "jupyter.notebook.ipynb",
            "filenamePattern": "*.ipynb"
        }
    ]
}

Final Checks

  1. Restart VSCode after updating your settings to apply changes.
  2. Open the command palette (Ctrl+Shift+P) and run Python: Select Interpreter to confirm you’ve picked the correct WSL Python instance.
  3. Save your python_record.py file—you should now see Pylint errors/warnings in the "Problems" panel (View > Problems) and inline in the editor.

If you still hit issues, run pylint python_record.py in the VSCode bash terminal to confirm it works, then check the Python output panel (View > Output > Select "Python") for any error messages.

内容的提问来源于stack exchange,提问作者Becky Heath

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.29 10:37:37