我在木星笔记本上使用tqdm。通常我会在白色的背景上看到一个绿色的进度条。然而,现在我在粉红色的背景上看到一个黑色的进度条:
import tqdm, tqdm.notebook
from time import sleep
# first progress bar
for i in tqdm.notebook.tqdm(range(10)):
sleep(.1)
# second progress bar
for i in tqdm.notebook.tqdm(range(10)):
sleep(.1)
# third progress bar
for i in tqdm.tqdm(range(10)):
sleep(.1)
# fourth progress bar
for i in tqdm.tqdm(range(10), colour='green'):
sleep(.1)
产生这四条:
我想要的是一个绿色的进度条,没有粉红色的背景。
在我安装PyQt5之后,行为发生了这种变化。我已经卸载了,但行为仍然存在。
此外,以前我在笔记本中使用tqdm.notebook.tqdm
作为进度条。现在,该函数不显示进度条(栏1和2)。我需要使用tqdm.tqdm
(第3和第4栏)。
我认为这个问题与后端有关。
发布于 2022-10-18 15:20:41
粉红色背景意味着输出到sys.stderr
。若要具有白色背景,请使用tqdm参数file
。更改颜色使用参数colour
for i in tqdm (range(50), file=sys.stdout, colour = 'GREEN'):
请参阅tqdm文档中的更多信息
https://stackoverflow.com/questions/71477963
复制相似问题