Skip to main content
 首页 » 编程设计

python之在 Python 3 中调用 gnome 终端子进程时出现 "Failed to execute child process (No such file or directory)"

2025年05月04日8TianFang

<分区>

我正在尝试编写一个打开 gnome 终端窗口并在其中执行 python 文件的程序。

当我用这样的子进程模块调用 gnome-terminal 子进程时:

import subprocess 
subprocess.call(['gnome-terminal', '-x', 'python3 '+filename]) 

我收到以下错误:

Failed to execute child process "python3 /home/user/Documents/test.py” (No such file or directory) 

我尝试先 cd 到目录 /home/user/Documents/test.py 然后运行该文件,但没有成功。