vscode conda 配置python环境(windows)

conda:用于 python安装包管理,能够自动匹配当前python版本的安装包,更换为清华路径后,下载速度很快。

    同时,可以创建多个环境。

    conda安装推荐不讲其保存到环境变量,但是如此的话,在cmd窗口很难使用conda命令。可以仅仅将conda

    的scripts路径保存到环境变量,则conda命令在cmd窗口可用。

    conda程序很大,如果需要环境不多,可以安装miniconda。

vscode配置:

seting.json,配置python路径

{
    "python.pythonPath": "X:\\MiniConda\\python"
}

  X位置为conda安装盘符

如果想要每次运行程序不在终端敲入命令,编写task.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Test",
            "type": "shell",
            "command": "X:\\MiniConda\\python",
            "args": [
                "${file}"
            ],
            "presentation": {
                "reveal": "always",
                "panel": "shared"
            },
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

  label:项目名称

备注:

  conda和vscode的powersell终端兼容有些问题,可以将默认终端改为cmd

  终端使用一段时间就会有许多命令,显示很混乱,可以自定义快捷键,清理终端。

猜你喜欢

转载自www.cnblogs.com/liudianfengmang/p/12732203.html