安装docker-compose报ERROR: Cannot uninstall ‘PyYAML‘. It is a distutils installed project and thus we c

安装docker-compose报ERROR: Cannot uninstall ‘PyYAML‘. It is a distutils installed project and thus we c,第1张

安装docker-compose报ERROR: Cannot uninstall ‘PyYAML‘. It is a distutils installed project and thus we c

在CentOS7中,如果python版本为3.x,在安装docker-compose时会报错:
ERROR: Cannot uninstall ‘PyYAML’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall

这是因为安装docker-compose需要更新PyYAML,PyYAML是由distutils安装的,而pip10以上的版本无法卸载distutils安装的软件(更新需要先卸载旧版本),所以可以把pip的版本先临时降到10以下,待安装完成后再恢复到最新版本:

#把pip版本降低
pip install --upgrade --force-reinstall pip==9.0.3
#尝试重新安装软件包
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple docker-compose==1.24.1
#最后,恢复最新版本的pip
pip install --upgrade pip

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5658015.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存