在 Windows 中终止子进程,访问被拒绝

2022-01-18 00:00:00 python windows subprocess terminate

问题描述

-

import time
import subprocess
from os.path import expanduser

chrome_path = expanduser('~Local SettingsApplication DataGoogleChromeApplicationchrome.exe')

proc = subprocess.Popen(chrome_path)
time.sleep(4)
proc.terminate()

输出:WindowsError: [错误 5] 访问被拒绝

如何终止 Chrome 进程?

How can I kill the Chrome process?

Windows XP 上的 Python 2.6.

Python 2.6 on Windows XP.


解决方案

如果你使用 TASKKILL/F/PID [number of process ID] 会发生什么?试一试.通过导入操作系统启动它

what happens if you use TASKKILL /F /PID [number of process ID] ? Give it a try. Launch it through import OS

相关文章