此问题已在此处有答案:
pip how to remove incorrectly installed package with a leading dash: "-pkgname"(4个答案)
15小时前关门了。
每当我尝试使用pip时,我都会收到大量的警告。我如何才能摆脱这些警告?
例如,我试图升级我的pip。
C:\Windows\system32>pip install --upgrade pip
WARNING: Ignoring invalid distribution -rotobuf (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -lrd (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -etworkx (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -ertifi (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -atplotlib (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -rotobuf (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -lrd (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -etworkx (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -ertifi (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -atplotlib (c:\programdata\anaconda3\lib\site-packages)
Requirement already satisfied: pip in c:\programdata\anaconda3\lib\site-packages (23.0.1)
WARNING: Ignoring invalid distribution -rotobuf (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -lrd (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -etworkx (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -ertifi (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -atplotlib (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -rotobuf (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -lrd (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -etworkx (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -ertifi (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -atplotlib (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -rotobuf (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -lrd (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -etworkx (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -ertifi (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -atplotlib (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -rotobuf (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -lrd (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -etworkx (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -ertifi (c:\programdata\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -atplotlib (c:\programdata\anaconda3\lib\site-packages)
这就是输出。
我试图升级我的pip,但它不工作。
1条答案
按热度按时间kkbh8khc1#
尝试使用选项
-q
:pip install -q --upgrade pip
根据文档(
pip install -h
),使用选项-q
一次可以消除警告消息,两次也可以消 debugging 误级别,三次也可以消除严重级别消息。如果你想将警告保存在一个文件中,以防以后需要读取它们,而只是不想在你的终端中看到它们,你可以用途:
pip install --upgrade pip 2> nameOfYourLog.File
编辑20230409:
如果你没有使用cygwin或类似unix的东西,
pip install --upgrade pip 2> nameOfYourLog.File
命令对你来说就不起作用了,但是根据在线文档,pip install -q --upgrade
仍然可以完成它的工作。