简体   繁体   English

从 python 脚本打开多个独立终端

[英]Open multiple independent terminal from a python script

I'm trying to open from a single script multiple in order to implement a sort of multi user.The number of users is unknown a priori, so i can't use multiprocess library with starmap.我试图从单个脚本中打开多个以实现一种多用户。用户的数量是先验未知的,所以我不能使用带有星图的多进程库。 I tried with gnu-terminal (i'm using elementary os) but it doeasn't work and even with screen or xterm it's the same.我尝试使用 gnu-terminal (我使用的是基本操作系统),但它不起作用,即使使用 screen 或 xterm 也是一样的。 I only need to launch a python script like happens when i open a new terminal and i launch it writing "python3 script.py"我只需要启动一个 python 脚本,就像我打开一个新终端并启动它时编写“python3 script.py”

On elementaryOS, you can open a new terminal with this command io.elementary.terminal在elementaryOS上,您可以使用此命令打开一个新终端io.elementary.terminal

So you can probably try this所以你可以试试这个

import os
os.system('io.elementary.terminal -e "python3 script.py"')

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

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