[Python] VS Code Python "Run" button shows "Unknown command" and routes to REPL instead of...

Discussão em 'Python' iniciado por Stack, Junho 4, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to run a Python file in VS Code using the "Run" button (the green triangle at the top right of the editor), but it doesn't work as expected. Instead of executing the script in the integrated terminal, I get this output:

    Unknown command '/Users/name/Documents/Team/venv/bin/python'. Type /? for help
    >>> /Users/name/Documents/Team/venv/bin/python "/Users/name/Documents/Team/Organized Files/main.py"
    Unknown command '/Users/name/Documents/Team/venv/bin/python'. Type /? for help
    >>> Send a message (/? for help)


    This looks like it's being run in a REPL or some chat-like interface instead of the proper terminal. Even when I kill the terminal and try again, it still runs in that environment and fails.

    If I manually open a new terminal and run:

    python3 "Organized Files/main.py"


    It runs fine.

    What I’ve tried:

    Confirmed the correct Python interpreter is selected (.venv/bin/python)

    Verified my launch.json:

    {
    "version": "0.2.0",
    "configurations": [
    {
    "name": "Python: Current File",
    "type": "debugpy",
    "request": "launch",
    "program": "${file}",
    "console": "integratedTerminal"
    }
    ]
    }


    I suspect this issue may be related to running a local DeepSeek model using Ollama in a Python script. Ever since I executed that script, this problem has been occurring, though I'm not entirely sure why it would affect how VS Code handles the Run button.

    Continue reading...

Compartilhe esta Página