Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
111 views
in Technique[技术] by (71.8m points)

How can I change the Python version in Visual Studio Code?

These are my settings:

  1. User Settings

    {
        "atomKeymap.promptV3Features": true,
        "editor.multiCursorModifier": "ctrlCmd",
        "editor.formatOnPaste": true,
        "python.pythonPath": "python3",
        "command": "python3",
    }
    
  2. Workspace Settings

    {
        "python.pythonPath": "${workspaceFolder}/env/bin/python3.6",
        "git.ignoreLimitWarning": true
    }
    
  3. tasks.json

    {
        // See https://go.microsoft.com/fwlink/?LinkId=733558
        // for the documentation about the tasks.json format
        "version": "0.1.0",
        "command": "python3",
        "isShellCommand": true,
        "args": ["${file}"],
        "showOutput": "always"
    }
    

If I use the debug console, the version and path is right: debug

But the output always defaults to "python2.7", no matter what I do. output

How can I fix this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Under the view menu select 'show command pallet'. One of the commands you can then select from the command palette is 'Python: Select Interpreter'. Selecting this option will allow you to choose which version of python to use.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...