我不能杀死绑定到8000端口的进程,因为我不能启动HTTP服务器。这是有关问题Start HTTP/HTTPS server, python -m SimpleHTTPServer的说明
C:\>taskkill /f /pid 4
ERROR: The process with PID 4 could not be terminated.
Reason: Access is denied.
我在某处发现,即使用下面的方法杀死也不起作用。
C:\>taskkill /f /s localhost /pid 4
ERROR: The process with PID 4 could not be terminated.
Reason: Access Denied.
PID 4是系统进程,在那里可能正在运行什么,我如何阻止它,为什么其他端口也是类似的方式监听。
C:\>netstat -ab
Active Connections
Proto Local Address Foreign Address State
TCP 0.0.0.0:135 garg10may-PC:0 LISTENING
RpcSs
[svchost.exe]
TCP 0.0.0.0:443 garg10may-PC:0 LISTENING
[vmware-hostd.exe]
TCP 0.0.0.0:445 garg10may-PC:0 LISTENING
Can not obtain ownership information
TCP 0.0.0.0:902 garg10may-PC:0 LISTENING
[vmware-authd.exe]
TCP 0.0.0.0:912 garg10may-PC:0 LISTENING
[vmware-authd.exe]
TCP 0.0.0.0:8000 garg10may-PC:0 LISTENING
Can not obtain ownership information
发布于 2015-10-04 16:13:55
根据python documentation,也可以使用带有端口号参数的解释器的-m
开关直接调用http.server
模块。与前面的示例类似,这将提供与当前目录相关的文件。
python -m http.server 8000
如果您的端口8000已在使用,只需将其更改为另一个no即可。
python -m http.server 5000
随意杀死进程和更多的系统进程并不是一个好主意。
发布于 2017-01-21 00:37:03
如果您使用的是Windows,这可能会对您有所帮助,端口80通常正由此服务使用:"World Wide Web Publishing Service",在控制面板中打开"Services“并停止它
发布于 2014-09-21 15:28:35
不要这样做--你不能杀死它是有原因的,因为你没有启动它。而是传递另一个端口号:
对于Python 3:
python -m http.server 8080
对于Python 2:
python -m SimpleHTTPServer 8080
https://stackoverflow.com/questions/25956531
复制相似问题