VScode配置python且安装pip出错详细解决办法(You are using pip version 19.2.3, however version 19.3.1 is available)

安装python教程请看上一个博客
安装第三方的包

通过python自带的pip工具,安装两个一会儿配置VScode需要的包。
flake8和yapf
flake8会检查编写代码时的不规范的地方和语法错误。
yapf是一个代码格式化工具,可以一键美化代码。
安装过程如下:
1、在cmd输入pip list检查是否已存在需要的包
2、输入pip install flake8下载安装flake8
3、输入pip install yapf下载安装yapf
具体过程如图。
VScode配置python且安装pip出错详细解决办法(You are using pip version 19.2.3, however version 19.3.1 is available)_第1张图片
VScode配置python且安装pip出错详细解决办法(You are using pip version 19.2.3, however version 19.3.1 is available)_第2张图片
然而报错了???

WARNING: You are using pip version 19.2.3, however version 19.3.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.

于是我们需要升级pip
解决pip更新问题
首先直接输入python -m pip install --upgrade pip
若成功就再好不过了~

(当直接输入python -m pip install --upgrade pip更新还报错的时候)
1.在命令行定位到你的pip所在文件夹下
例如我的位置在
VScode配置python且安装pip出错详细解决办法(You are using pip version 19.2.3, however version 19.3.1 is available)_第3张图片
所以输入以下命令定位到你的pip所在文件夹下
我们要打开的是python文件夹 故我们继续输入 cd python 就可以了!
VScode配置python且安装pip出错详细解决办法(You are using pip version 19.2.3, however version 19.3.1 is available)_第4张图片
继续输入pip3.exe命令
VScode配置python且安装pip出错详细解决办法(You are using pip version 19.2.3, however version 19.3.1 is available)_第5张图片
继续输入python -m pip install --upgrade pip命令,出现如下界面即成功。
VScode配置python且安装pip出错详细解决办法(You are using pip version 19.2.3, however version 19.3.1 is available)_第6张图片
则继续输入pip install flake8下载安装flake8
VScode配置python且安装pip出错详细解决办法(You are using pip version 19.2.3, however version 19.3.1 is available)_第7张图片
输入pip install yapf下载安装yapf
在这里插入图片描述
ok!

Now安装python插件

1、打开VScode,按下快捷键Ctrl+Shift+X,进入插件管理页面。
2、在搜索栏输入python。
3、选择目录中第一个插件,点击安装。

VScode配置python且安装pip出错详细解决办法(You are using pip version 19.2.3, however version 19.3.1 is available)_第8张图片
配置launch.json
这一步主要是配置调试的,打开launch.json:调试 >> 打开配置
修改 pythonpath 词条:

"version": "0.2.0",
    "configurations": [
        {
            "name": "Python",
            "type": "python",
            "request": "launch",
            "stopOnEntry": false,
            //"pythonPath": "C:/Python27/python",
            "pythonPath": "C:/Users/yanta/AppData/Local/Programs/Python/Python36/python",
            "program": "${file}",
            "cwd": "${workspaceRoot}",
            "env": {},
            "envFile": "${workspaceRoot}/.env",
            "debugOptions": [
                "WaitOnAbnormalExit",
                "WaitOnNormalExit",
                "RedirectOutput"
            ]
        },

配置tasks.json
这一步主要是配置任务的,通常对于小的文件可以直接使用快捷键执行python脚本。
快捷键:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "python",
            "type": "shell",
            "command": "C:/Users/yanta/AppData/Local/Programs/Python/Python36/python",
            "args": [
                "${file}"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

然后你就可以新建一个文件夹建一个.py的文件,撒花~
附赠樱花树代码&&佩奇代码~

你可能感兴趣的:(VScode配置python且安装pip出错详细解决办法(You are using pip version 19.2.3, however version 19.3.1 is available))