Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/359.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 运行脚本以在终端中调用命令_Python_Bash_Shell_Raspberry Pi3 - Fatal编程技术网

Python 运行脚本以在终端中调用命令

Python 运行脚本以在终端中调用命令,python,bash,shell,raspberry-pi3,Python,Bash,Shell,Raspberry Pi3,我正在尝试在raspbian上运行它,终端弹出并保持空白/消失。有人能告诉我为什么会发生这种情况,我如何防止这种情况发生,请提前提出建议并感谢 #!/bin/bash export PYTHONPATH=$1/env nohup x-terminal-emulator -e $1/env/bin/python $1/Web_Server/run/script.py #--------- 在bash脚本中通过xterm-hold-e更改x-terminal-emulator后,我们可以设法弹出

我正在尝试在raspbian上运行它,终端弹出并保持空白/消失。有人能告诉我为什么会发生这种情况,我如何防止这种情况发生,请提前提出建议并感谢

#!/bin/bash
export PYTHONPATH=$1/env
nohup x-terminal-emulator -e $1/env/bin/python 
$1/Web_Server/run/script.py
#---------

在bash脚本中通过
xterm-hold-e
更改
x-terminal-emulator
后,我们可以设法弹出一个新的终端并运行python

#!/bin/bash
export PYTHONPATH=$1/env
nohup xterm -hold -e $1/env/bin/python $1/Web_Server/run/script.py

你确定你能在后台用nohup运行你的
x-terminal-emulator
吗?你能试试吗:
nohup xterm-hold-e$1/env/bin/python$1/Web_Server/run/script.py
??请注意,
$1/env/bin/python
$1/Web\u Server/run/script.py
应该在同一行!!!谢谢xterm-hold-e完成了这项工作。如果我的答案解决了您的问题,请单击大复选标记接受它(✓) 在它旁边,也可以选择向上投票(向上投票要求至少15个信誉点)。如果您发现其他答案有帮助,请向上投票。接受和向上投票有助于未来的读者。请参阅[相关帮助中心文章][1][1]: