一、现象描述
最近使用python 调用 progressbar 包,一般情况下, prograssbar 就是一个进度条。max_value代表进度条的长度。但是自己运行python文件时 报如下错误:
Traceback (most recent call last):
File "./kittipoles.py", line 369, in <module>
save_local_maps(13)
File "./kittipoles.py", line 74, in save_local_maps
with progressbar.ProgressBar(max_value=len(iend)) as bar:
TypeError: __init__() got an unexpected keyword argument 'max_value'
二、解决方法
解决方法很简单,升级 progressbar 的版本就可以。
首先卸载掉当前的 progressbar
pip uninstall progressbar
安装新版 progressbar (参考官网 pypi )
pip install progressbar2
然后再次运行就不会报错了~~
(参考链接[1] 展示了另一个解决方法,也可以参考下)
参考链接:
[1] 解决问题:chainer:TypeError: call() got an unexpected keyword argument ‘max_value’ - https://blog.csdn.net/qq_29134801/article/details/90900950
[2] Python安装progressbar遇到的问题及解决 https://blog.csdn.net/hhy_csdn/article/details/80186833?utm_source=blogxgwz6
[3] python progressbar 在进度条中添加自己动态的信息(防止花眼) https://blog.csdn.net/qq_35634073/article/details/111086274