简体   繁体   English

在python脚本的Terminal中运行$ Path命令

[英]Run $Path command in Terminal in a python script

i use ipython notebook and I want to call a terminal command: fft <in> <out> 我使用ipython笔记本,我想调用终端命令: fft <in> <out>

my "fft" is in my $PATH so using a terminal, this would work. 我的“ fft”在我的$ PATH中,因此使用终端,这可以工作。

How can I run this command in my ipython notebook? 如何在我的ipython笔记本中运行此命令?


the problem is that my fft executable is in my $PATH folder, and python won't recognize this 问题是我的fft可执行文件在$ PATH文件夹中,而python无法识别此文件

Found the solution: 找到了解决方案:

import os    
os.system("xterm -e 'bash -c \"fft -i 3 AddedK AddedK_ifft; exit -f exec bash\"' ")

xterm opens a new terminal xterm打开一个新终端

fft ...; calls the function fft 调用函数fft

exit -f closes the terminal exit -f关闭终端

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

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