当使用pip时,出现下列警告提示
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
可以使用下列命令来进行更新pip版本
pip install --user --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple pip
查看pip版本的命令为
pip -V
再次使用pip时 会出现下列问题
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
大致意思就是pip和python版本不匹配
解决这个问题的方法是
每次使用pip的时候 需要在前面加上 python -m
例如 需要下载xx时
命令为
python -m pip -i install https://pypi.douban.com/simple xx
命令中的网址为pip源网址 国内的有以下几个
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
使用国内的网址可以避免出现下载超时的情况
如果长期使用 上面的命令太过于繁琐
这就需要在C:/用户/xx 下建立一个pip目录
在C:/用户/xx/pip 下建立pip.ini文件
内容为:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple/