我的 pip 版本已关闭——每个 pip 命令都在说:
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 进行干净的系统安装:
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
但后来我得到了:
==> 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
。什么是正确的命令使用?
原文由 personal_cloud 发布,翻译遵循 CC BY-SA 4.0 许可协议
有很多选择(2021 更新)…
使用命令行标志
从命令行配置 pip
设置环境变量
使用配置文件
创建一个 pip 配置文件并将
disable-pip-version-check
设置为 true在许多 Linux 上,pip 配置文件的默认位置是
$HOME/.config/pip/pip.conf
。 Windows、macOS 和 virtualenvs 的位置太多了,这里无法详细说明。请参阅文档:https://pip.pypa.io/en/stable/user_guide/#config-file