对于 Python 代码:Mac OS X 是否包含 X 终端? (如果不是,哪一个?)
我似乎无法在谷歌上找到答案。任何人都可以检查 xterm
是否默认安装在 Mac OS X 上,或者更好的是,是否定义了程序/链接 x-terminal-emulator
?
我问的原因是我当前正在运行这个 python3 代码
process = subprocess.Popen ( ['x-terminal-emulator', '-e', 'sh -c "cd"' ] )
(为了简单起见,用 cd 替换更复杂的 bash 命令)并且更喜欢与 mac 兼容。如果有人也可以检查它是否正常运行(它应该只是短暂地弹出一个新终端),我将不胜感激。
否则,我应该调用哪个终端来执行该特定命令?
谢谢!
I can't seem to find an answer on google. Can anyone please check if xterm
is installed on Mac OS X by default, or better yet, if the program/link x-terminal-emulator
is defined?
The reason I am asking is that I am currently running this python3 code
process = subprocess.Popen ( ['x-terminal-emulator', '-e', 'sh -c "cd"' ] )
(for simplicity, more complicated bash command replaced with cd
) and would prefer compatibility with mac. If anyone could also check that this runs gracefully (it should just briefly pop up a new terminal), I'd be obliged.
Otherwise, which terminal should I call for that specific command?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Mac OS X 的 X11 是默认安装的,但它是可选的,因此您无法确定 xterm 是否已安装,请参阅 http://developer.apple.com/opensource/tools/x11.html
Mac OS X 机器上始终存在的是 Terminal.app
X11 for Mac OS X is installed by default, but it's optional, so you cannot be sure xterm is installed, see http://developer.apple.com/opensource/tools/x11.html
What is always there on a Mac OS X box is the Terminal.app
如果您专门调用
'xterm'
(没有x-terminal-emulator
链接),那么至少在 Lion 上是有效的。That works, at least on Lion, if you call
'xterm'
specifically (there is nox-terminal-emulator
link).