给python流程一个Windows的名称或标题
我有多个python脚本,它们一直在后台运行。我需要区分它们。因此,我考虑提供每个脚本,例如任务管理器或 Process Explorer 中显示的名称或标题。 从我搜索的内容来看,这在 linux 中是可能的,而 Windows 则不可能。 我尝试了一个模块 setProctitle ,但它不起作用。
我尝试使用pytoexe,它有效,但是很难,因为每次您编辑代码时都需要生成EXE文件。
是否有任何便携式方法可以将每个Python脚本一个名称显示在 Process Explorer 中?
I have multiple python scripts that keep running in background. I need to distinguish between them. So I think about giving every script like a name or title that shows up in task manager or PROCESS EXPLORER .
From what I searched, this is possible in Linux, and impossible in windows.
I Tried a module SETPROCTITLE but It didn't work.
I tried using pytoexe, It works but It's difficult as It requires to generate an exe file every time you edit your code.
Is there any portable method to give every python script a name that display it in PROCESS EXPLORER ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
许多应用程序都有数十亿个实例很难区分。
在任务管理器中,我使用“详细信息”选项卡。右键单击“列标题”之一,然后从上下文弹出菜单中选择“选择列”。如果选择“命令行”列(并使窗口足够宽),则可以通过脚本的名称区分Python进程。
我敢肯定,Process Explorer也可以显示命令行,但是我不经常使用它来记住细节。
Lots of applications have zillions of instances that can be hard to distinguish.
In Task Manager, I use the Details tab. Right click on one of the column headers, and choose "Select columns" from the contextual pop-up menu. If you select the "Command line" column (and make your window wide enough), you might be able to distinguish between your python processes by the name of the script.
I'm pretty sure Process Explorer can also show the command line, but I don't use it frequently enough to remember the details.
安装 pyinstaller 并创建 .exe 文件:
Install pyinstaller and create a .exe file: