如何在 Visual Studio Code 中更改 Python 版本? [英] How can I change the Python version in Visual Studio Code?

查看:54
本文介绍了如何在 Visual Studio Code 中更改 Python 版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这些是我的设置:

  1. 用户设置

  1. User Settings

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

  • 工作区设置

  • Workspace Settings

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

  • tasks.json

  • 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:

    但无论我做什么,输出总是默认为python2.7".

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

    我该如何解决这个问题?

    How can I fix this?

    推荐答案

    在视图菜单下选择显示命令托盘".然后您可以从命令面板中选择的命令之一是Python:选择解释器".选择此选项将允许您选择要使用的 Python 版本.

    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.

    这篇关于如何在 Visual Studio Code 中更改 Python 版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆