关于#python#的问题:指令内容只要需要连接网络,进行conda升级等就会出现大量DEBUG信息

在终端使用conda指令出现大量DEBUG信息

指令内容只要需要连接网络,比如安装某些包,进行conda升级等就会出现大量DEBUG信息。
这是为什么,以及怎样才能关闭这些信息。已经尝试使用conda update conda -q,重装anaconda等方法,但是仍不能取消这些输出。

img

(base) C:\Users\admin>conda update conda
Collecting package metadata (current_repodata.json): \ DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): repo.anaconda.com:443
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): repo.anaconda.com:443
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): repo.anaconda.com:443
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mirrors.tuna.tsinghua.edu.cn:443
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): repo.anaconda.com:443
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mirrors.tuna.tsinghua.edu.cn:443
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): repo.anaconda.com:443
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): repo.anaconda.com:443
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mirrors.tuna.tsinghua.edu.cn:443
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mirrors.tuna.tsinghua.edu.cn:443
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mirrors.tuna.tsinghua.edu.cn:443
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mirrors.tuna.tsinghua.edu.cn:443
| DEBUG:urllib3.connectionpool:https://mirrors.tuna.tsinghua.edu.cn:443 "GET /anaconda/pkgs/free/noarch/current_repodata.json HTTP/1.1" 404 None
DEBUG:urllib3.connectionpool:https://mirrors.tuna.tsinghua.edu.cn:443 "GET /anaconda/cloud/conda-forge/win-64/current_repodata.json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:https://mirrors.tuna.tsinghua.edu.cn:443 "GET /anaconda/cloud/conda-forge/noarch/current_repodata.json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:https://mirrors.tuna.tsinghua.edu.cn:443 "GET /anaconda/cloud/msys2/win-64/current_repodata.json HTTP/1.1" 404 None
DEBUG:urllib3.connectionpool:https://mirrors.tuna.tsinghua.edu.cn:443 "GET /anaconda/pkgs/free/win-64/current_repodata.json HTTP/1.1" 404 None
DEBUG:urllib3.connectionpool:https://mirrors.tuna.tsinghua.edu.cn:443 "GET /anaconda/cloud/msys2/noarch/current_repodata.json HTTP/1.1" 404 None
DEBUG:urllib3.connectionpool:https://mirrors.tuna.tsinghua.edu.cn:443 "GET /anaconda/pkgs/free/noarch/repodata.json HTTP/1.1" 304 0
DEBUG:urllib3.connectionpool:https://mirrors.tuna.tsinghua.edu.cn:443 "GET /anaconda/cloud/msys2/win-64/repodata.json HTTP/1.1" 304 0
DEBUG:urllib3.connectionpool:https://mirrors.tuna.tsinghua.edu.cn:443 "GET /anaconda/pkgs/free/win-64/repodata.json HTTP/1.1" 304 0
DEBUG:urllib3.connectionpool:https://mirrors.tuna.tsinghua.edu.cn:443 "GET /anaconda/cloud/msys2/noarch/repodata.json HTTP/1.1" 304 0
- DEBUG:urllib3.connectionpool:https://repo.anaconda.com:443 "GET /pkgs/main/noarch/current_repodata.json HTTP/1.1" 304 0
DEBUG:urllib3.connectionpool:https://repo.anaconda.com:443 "GET /pkgs/r/win-64/current_repodata.json HTTP/1.1" 304 0
\ DEBUG:urllib3.connectionpool:https://repo.anaconda.com:443 "GET /pkgs/msys2/noarch/current_repodata.json HTTP/1.1" 304 0
DEBUG:urllib3.connectionpool:https://repo.anaconda.com:443 "GET /pkgs/main/win-64/current_repodata.json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:https://repo.anaconda.com:443 "GET /pkgs/r/noarch/current_repodata.json HTTP/1.1" 304 0
DEBUG:urllib3.connectionpool:https://repo.anaconda.com:443 "GET /pkgs/msys2/win-64/current_repodata.json HTTP/1.1" 304 0
done
Solving environment: done

原因

conda_build版本问题问题

解决方法:

这个问题实际上是由conda_build 3.26.0. conda_build 3.25.0您可以通过降级或等待新版本的conda_build出现来消除问题!这将做到这一点:

conda install "conda-build!=3.26.0"

具体的问题和解决方法在这里有提到过:
参考链接:


如有问题随时沟通
如有帮助欢迎采纳

将命令的标准输出重定向到 /dev/null,将包括 DEBUG 信息的输出丢弃。

conda install package_name > /dev/null

DEBUG 信息如果是通过标准错误输出显示的,将标准错误输出重定向到 /dev/null。

conda install package_name 2> /dev/null

为啥一定要选清华源,换成其它如阿里源,或者直接使用国外的试试

在执行 Python 脚本之前,可以设置 PYTHONWARNINGS 环境变量来控制警告信息的输出。例如,你可以将环境变量设置为 ignore,以忽略所有警告信息:

export PYTHONWARNINGS="ignore"
python your_script.py


  • 可以调整verbose回显等级,使用参数-v
    conda update -v conda
    
  • 另外-q是关闭进度条