通过Kali Linux中的终端打开程序

时间:2020-04-10 14:58:29

标签: python linux terminal subprocess command

尝试在Kali Linux中轻松打开pyCharm。我一直在学习在线课程,打开pyCharm的方法是导航到.sh文件并打开它。我尝试使用subprocess模块​​自动执行该过程,但出现错误:

没有这样的文件或目录:'cd':'cd'

我的代码:

import subprocess
subprocess.call("cd")
subprocess.call("cd", "Downloads/pycharm-community-2019.2.3/bin")
subprocess.call("/.pycharm.sh")

1 个答案:

答案 0 :(得分:0)

将外壳设置为True:

import subprocess
subprocess.call("cd", shell=True)
subprocess.call("cd", "Downloads/pycharm-community-2019.2.3/bin", shell=True)
subprocess.call("/.pycharm.sh", shell=True)
 #it is "./pycharm.sh"