当前位置: 代码迷 >> 综合 >> TypeError: start() got an unexpected keyword argument 'maxval'
  详细解决方案

TypeError: start() got an unexpected keyword argument 'maxval'

热度:0   发布时间:2023-12-15 17:20:26.0

报错:

最小示例代码:

xxx@lthpc:~/dataset/tubcrowd$ python3
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import progressbar
>>> pb = progressbar.ProgressBar()>>> pb.start(max_value=1)
Traceback (most recent call last):File "<stdin>", line 1, in <module>
TypeError: start() got an unexpected keyword argument 'max_value'# 根据网上的修改成maxval,还是报错:
>>> pb.start(maxval=1)
Traceback (most recent call last):File "<stdin>", line 1, in <module>
TypeError: start() got an unexpected keyword argument 'maxval'>>> progressbar.__version__
'2.5'

原因:progressbar版本不对,比如我是用了progressbar 2.5,更进一步的原因还未细究。

解决:卸载原来的progressbar,重新安装progressbar 3.46.1即可。其他版本还未测试过。仅供参考。

最小示例:


xxx@lthpc:~/dataset/tubcrowd$ source crowdflow_env/bin/activate
(crowdflow_env) xxx@lthpc:~/dataset/tubcrowd$ python
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import progressbar
>>> pb = progressbar.ProgressBar()
>>> pb.start(max_value=10)
N/A% (0 of 10) |                        | Elapsed Time: 0:00:00 ETA:  --:--:--<progressbar.bar.ProgressBar object at 0x7f971f47cb38>
>>> progressbar.__version__
'3.46.1'

另:可以直接安装progressbar2解决:

$ pip install progressbar2

 

  相关解决方案