我的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.
Run Code Online (Sandbox Code Playgroud)
而且我不喜欢这里给出的答案:我如何摆脱这个警告从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
Run Code Online (Sandbox Code Playgroud)
但后来我得到了:
==> 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.
Run Code Online (Sandbox Code Playgroud)
所以我似乎使用了错误的命令来安装pip
.什么是正确的命令?
Joh*_*Mee 27
创建一个pip配置文件并设置disable-pip-version-check
为true
[global]
disable-pip-version-check = True
Run Code Online (Sandbox Code Playgroud)
在很多linux上,pip配置文件的默认位置是$HOME/.config/pip/pip.conf
.Windows,macOS和virtualenvs的位置太多了,无法在此处详述.请参阅文档:
https://pip.pypa.io/en/stable/user_guide/#config-file
小智 24
或者只使用命令行标志
pip --disable-pip-version-check [normal stuff here]
Run Code Online (Sandbox Code Playgroud)
Lev*_*von 20
只是添加到@sorin 的答案
在 Dockerfile 中添加这两行以禁用 pip 版本检查和缓存。
FROM python:3.6.10
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
ENV PIP_NO_CACHE_DIR=1
RUN pip3 install -r requirements.txt
# ...
Run Code Online (Sandbox Code Playgroud)
sor*_*rin 14
另一种侵入性较小且未直接记录但完全支持的禁用版本检查的方法是定义:
export PIP_DISABLE_PIP_VERSION_CHECK=1
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5030 次 |
最近记录: |