MAC OS-os.system(命令)不显示任何内容 [英] MAC OS - os.system(command) display nothing
本文介绍了MAC OS-os.system(命令)不显示任何内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我运行IDLE(python 3.8)时:
When I run IDLE (python 3.8) :
>>> import os
>>> os.system("ls")
0
>>> os.system('echo "test"')
0
>>> os.system("users")
0
>>>
但如果我这样做:
os.system("ls > test.txt")
test.txt文件已创建并包含结果.
The test.txt file is created and contain the result.
我尝试重新安装,所有内容都无法正常工作...仅当我在终端中运行python时,命令才有效,但IDLE似乎更适合工作.
I tried to reinstall and everything, nothing works... Only if I Run python in my terminal, command works but IDLE seems better for work.
谁能帮助我?谢谢
推荐答案
我遇到了同样的问题,这就是我所做的:
I get the same issue and this is what I did:
- 重新启动IDLE.
- 重新启动笔记本电脑.
但是,同样的问题仍然存在.
However, the same problem persists.
我的建议是,为什么不使用终端机而不是使用IDLE?就我而言,我使用iTerm.
My suggestion is, instead of using IDLE, why don't you use the terminal? In my case, I use iTerm.
$ python3.8
$ >>> import os
$ >>> os.system("ls")
一切正常.
这篇关于MAC OS-os.system(命令)不显示任何内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文