每当我尝试使用pip时,我都会得到大量的警告。我怎样才能摆脱这些呢?
例如,我试图升级我的pip。
C:Windowssystem32>pip install --upgrade pip
WARNING: Ignoring invalid distribution -rotobuf (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -lrd (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -ip (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -etworkx (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -ertifi (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -atplotlib (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -rotobuf (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -lrd (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -ip (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -etworkx (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -ertifi (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -atplotlib (c:programdataanaconda3libsite-packages)
Requirement already satisfied: pip in c:programdataanaconda3libsite-packages (23.0.1)
WARNING: Ignoring invalid distribution -rotobuf (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -lrd (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -ip (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -etworkx (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -ertifi (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -atplotlib (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -rotobuf (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -lrd (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -ip (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -etworkx (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -ertifi (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -atplotlib (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -rotobuf (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -lrd (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -ip (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -etworkx (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -ertifi (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -atplotlib (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -rotobuf (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -lrd (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -ip (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -etworkx (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -ertifi (c:programdataanaconda3libsite-packages)
WARNING: Ignoring invalid distribution -atplotlib (c:programdataanaconda3libsite-packages)
这就是输出
我尝试升级我的pip,但是它不工作。
尝试使用选项-q
:
pip install -q --upgrade pip
根据文档(pip install -h
),使用选项-q
一次使您摆脱警告消息,两次也使您摆脱错误级别,三次也使您摆脱临界级别消息。
如果您想将警告保存在文件中,以备以后需要阅读它们,而不希望它们出现在您的终端中,您可以使用:
pip install --upgrade pip 2> nameOfYourLog.File
编辑20230409:
我真笨,我没注意到你在用Windows。如果您没有使用cygwin或类似unix的东西,那么命令pip install --upgrade pip 2> nameOfYourLog.File
将不适合您,但是根据在线文档,pip install -q --upgrade
应该仍然可以完成它的工作。