首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何抑制pip升级警告?

如何抑制pip升级警告?
EN

Stack Overflow用户
提问于 2017-09-18 22:06:15
回答 6查看 29K关注 0票数 58

我的pip版本被关闭了--每个pip命令都在说:

代码语言:javascript
运行
复制
You are using pip version 6.0.8, however version 8.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

我不喜欢这里给出的答案:How can I get rid of this warning to upgrade from pip?,因为他们都想让pip与RH版本脱节。

因此,我尝试用这个VagrantFile安装一个干净的系统:

代码语言:javascript
运行
复制
Vagrant.configure("2") do |config|

  config.ssh.username   = 'root'
  config.ssh.password   = 'vagrant'
  config.ssh.insert_key = 'true'

  config.vm.box = "bento/centos-7.3"

  config.vm.provider "virtualbox" do |vb|
    vb.cpus   = "4"
    vb.memory = "2048"
  end

  config.vm.synced_folder "..", "/vagrant"

  config.vm.network "public_network", bridge: "eth0", ip: "192.168.1.31"

  config.vm.provision "shell", inline: <<-SHELL
    set -x

    # Install pip
    yum install -y epel-release
    yum install -y python-pip
    pip freeze   # See if pip prints version warning on fresh OS install.

  SHELL

end

但后来我得到了:

代码语言:javascript
运行
复制
==> default: ++ pip freeze
==> default: You are using pip version 8.1.2, however version 9.0.1 is available.
==> default: You should consider upgrading via the 'pip install --upgrade pip' command.

因此,我似乎使用了错误的命令来安装pip。什么是正确的命令使用?

EN

回答 6

Stack Overflow用户

回答已采纳

发布于 2017-09-18 22:17:19

有许多选项(2021年更新).

使用命令行标志

代码语言:javascript
运行
复制
pip <command> --disable-pip-version-check [options]

从命令行配置pip

代码语言:javascript
运行
复制
pip config set global.disable-pip-version-check true

设置环境变量

代码语言:javascript
运行
复制
export PIP_DISABLE_PIP_VERSION_CHECK=1

使用配置文件

创建一个pip配置文件并将disable-pip-version-check设置为true

代码语言:javascript
运行
复制
[global]
disable-pip-version-check = True

在许多linux上,pip配置文件的默认位置是$HOME/.config/pip/pip.conf。Windows、macOS和virtualenvs的位置非常不同,无法在这里详细说明。请参阅文档:

guide/#config-file

票数 81
EN

Stack Overflow用户

发布于 2018-09-27 17:45:47

或者只使用命令行标志。

代码语言:javascript
运行
复制
pip --disable-pip-version-check [normal stuff here]
票数 50
EN

Stack Overflow用户

发布于 2019-01-14 09:48:56

另一种不太具有侵扰性且不直接记录但完全支持的禁用版本检查的方法是定义:

代码语言:javascript
运行
复制
export PIP_DISABLE_PIP_VERSION_CHECK=1
票数 36
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46288847

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档