[linux操作]module ‘yaml‘ has no attribute ‘FullLoader‘

module ‘yaml’ has no attribute 'FullLoader’

在用yaml这个库时产生错误:
module ‘yaml’ has no attribute ‘FullLoader’
这是因为FullLoader 属性是在pyyaml5.1及以上版本中才有的。

然后就需要我们安装版本更高一点的pyyaml
正常操作直接先
pip uninstall yaml

pip install yaml==**就行了

但这个yaml库的卸载有点难搞,直接卸载不了

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.

如果你想直接跳过低版本的安装高版本的,也会报错:
在这里插入图片描述
解决方法:

pip install docker-py --ignore-installed PyYAML

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_49627776/article/details/121309023