AttributeError: module 'yaml' has no attribute 'FullLoader'

今天在用yaml的时候出现了下面的错误:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
 in 
      1 with open(config, 'r') as f:
----> 2     params = yaml.load(f, Loader=yaml.FullLoader)

AttributeError: module 'yaml' has no attribute 'FullLoader'

解决方法

pip install --ignore-installed PyYAML

参考文献

[1].AttributeError: 'module' object has no attribute 'FullLoader'. https://github.com/Yelp/elastalert/issues/2298

[2].安装yaml报错:ERROR: Cannot uninstall 'PyYAML'. https://blog.csdn.net/weixin_41010198/article/details/103852838

你可能感兴趣的:(PyYAML,python学习)