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

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

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-8-e2164f893693> in <module>
      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

猜你喜欢

转载自blog.csdn.net/w5688414/article/details/104923033
今日推荐