MINGW64 在执行期间不打印
MINGW64 doesn't print during execution
我正在使用 Git Bash to run my Python scripts on Windows. I noticed that the console doesn't print while my scripts are running. All the strings are printed just when the scripts finish. I read,这是一个缓冲区和换行符问题。我该如何解决?
我在每个 print()
.
之后解决这个问题,包括 sys.stdout.flush()
我在 Windows10 上使用 MINGW64,python -u
适合我。例如,
python -u foo.py
来自python --help
:
-u : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x
see man page for details on internal buffering relating to '-u'
我正在使用 Git Bash to run my Python scripts on Windows. I noticed that the console doesn't print while my scripts are running. All the strings are printed just when the scripts finish. I read,这是一个缓冲区和换行符问题。我该如何解决?
我在每个 print()
.
sys.stdout.flush()
我在 Windows10 上使用 MINGW64,python -u
适合我。例如,
python -u foo.py
来自python --help
:
-u : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x see man page for details on internal buffering relating to '-u'