繁体   English   中英

在命令行中运行 python 文件不会产生 output

[英]Running python file in command line yields no output

在考虑了这个问题之后,我的命令提示符似乎有问题。

甚至包含以下代码的名为test.py的文件

 print("hi")

在 windows 10 上的命令提示符中调用时不会导致显示任何 output

Output

C:\Users\Admin>python test.py

C:\Users\Admin>

意思是什么都没有打印。

正如我原来的问题中所建议的那样,我也尝试运行

python -u -c "print('hello')"

这也不会产生任何 output 。

已经有一个问题与相同的问题有关,但是还没有任何答案。

Apparently using the command prompt doesn't work, however I've been using the anaconda distribution for python and using the anaconda command prompt instead of the windows 10 one solves the problem.

Output

(base) C:\Users\Admin>python test.py
hi

(base) C:\Users\Admin>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM