![python3 RuntimeWarning:二进制模式下不支持行缓冲(buffering=1),将使用默认缓冲区大小](https://linux22.com/image/921834/python3%20RuntimeWarning%EF%BC%9A%E4%BA%8C%E8%BF%9B%E5%88%B6%E6%A8%A1%E5%BC%8F%E4%B8%8B%E4%B8%8D%E6%94%AF%E6%8C%81%E8%A1%8C%E7%BC%93%E5%86%B2%EF%BC%88buffering%3D1%EF%BC%89%EF%BC%8C%E5%B0%86%E4%BD%BF%E7%94%A8%E9%BB%98%E8%AE%A4%E7%BC%93%E5%86%B2%E5%8C%BA%E5%A4%A7%E5%B0%8F.png)
我最近将我的 Ubuntu 从 更新到19.10
了20.04
。在安装过程中以及现在运行时,apt update
我看到了与 python 相关的警告:
/usr/lib/python3.8/subprocess.py:838: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used self.stdin = io.open(p2cwrite, 'wb', bufsize)
我该如何修复它?
答案1
在这里,您可以看到有关此问题的讨论:
这里有一个修复:
但请记住...这不是一个错误,而是一个功能:)
答案2
我没有这样的问题“apt 更新”在 20.4
shell> cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
就我而言,问题是由 Ansible 插件引起的丝裂原
shell> ansible-playbook --version
ansible-playbook 2.9.6
config file = /home/admin/.ansible.cfg
configured module search path = ['/home/admin/.ansible/my_modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0]
shell> ansible localhost -m setup
/usr/lib/python3.8/os.py:1023: RuntimeWarning: 二进制模式下不支持行缓冲(buffering=1),将使用默认缓冲区大小返回 io.open(fd, *args, **kwargs)
当我禁用丝裂原时,问题消失了
shell> grep strategy ansible.cfg
# strategy = mitogen_linear