在使用yaml.dump时出现TypeError错误

在调用下面代码时出错:

yaml.dump(hyp, f, sort_keys=False)

报错:

TypeError: dump_all() got an unexpected keyword argument 'sort_keys'

报错原因:

yaml版本过低造成 

解决方法:升级yaml版本

pip install --upgrade PyYAML

但是又出现新的问题:

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.

解决办法:

pip install --upgrade PyYAML --ignore-installed

安装成功。

猜你喜欢

转载自blog.csdn.net/u012505617/article/details/120901413