I wrote some animation script with Python and used Pyinstaller to make it an .exe file. The code works fine in PyCharm, i.e. only displaying single line of progress bar. However, when I open the .exe which I believe is running in shell prompt, it's displaying multiple lines. I'm on Windows 10 and Python 3.7. The issue is easy to replicate on my PC. Below is an example.
import matplotlib.pyplot as plt
import matplotlib.animation as ani
import numpy as np
import pandas as pd
from tqdm import tqdm
fig = plt.figure(figsize=(20,12))
ax1 = plt.subplot2grid((2, 2), (0, 0), colspan=2, rowspan=2)
def test(i):
data = np.random.normal(0, 1, i+1)
pd.DataFrame(data).plot(kind='bar', ax=ax1)
Writer = ani.writers['ffmpeg']
writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1000)
anim = ani.FuncAnimation(fig=fig, func=test, frames=tqdm(range(10), initial=1, position=0), interval=200, blit=False)
anim.save('textmovie.mp4', writer=writer)
If I run it in PyCharm, it looks like this.

After I use Pyinstaller to generate the .exe, it looks like this.

I have searched for similar issues here. Seems like people suggest using position=0, but it doesn't work for me. Do I miss anything in my code?
I know I can make the progress bar by myself instead of using tqdm. But I would like to use tqdm if possible as it provides more information like iteration speed and estimated time.