端口51347似乎已被另一个程序使用 [英] Port 51347 seems to be used by another program

查看:110
本文介绍了端口51347似乎已被另一个程序使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行dispy文档中给出的示例代码

def compute(n):
导入时间,套接字
time.sleep(n )
host = socket.gethostname()
return(host,n)
如果 name ==' main ':
导入dispy,随机
群集= dispy.JobCluster(compute)
个工作= []
对于范围(10)中的i:
#调度对'compute'的执行带有参数的节点(运行 dispynode)
#(在这种情况下为随机数)
job = cluster.submit(random.randint(5,20))
job.id = i#(可选)将ID与作业关联(如果以后需要)
jobs.append(job)
#cluster.wait()#等待所有计划的作业完成
的作业:
host,n = job()#等待作业完成并返回结果
print('%s执行的作业%s在%s与%s'%(host,job.id,job。 start_time,n))
#工作的其他字段有用:
#print(job.stdout,job.stderr,job.exception,job.ip_addr,job.start_time,job.end_time)
cluster.print_status()

On running the sample code given in the dispy documentation def compute(n): import time, socket time.sleep(n) host = socket.gethostname() return (host, n) if name == 'main': import dispy, random cluster = dispy.JobCluster(compute) jobs = [] for i in range(10): # schedule execution of 'compute' on a node (running 'dispynode') # with a parameter (random number in this case) job = cluster.submit(random.randint(5,20)) job.id = i # optionally associate an ID to job (if needed later) jobs.append(job) # cluster.wait() # wait for all scheduled jobs to finish for job in jobs: host, n = job() # waits for job to finish and returns results print('%s executed job %s at %s with %s' % (host, job.id, job.start_time, n)) # other fields of 'job' that may be useful: # print(job.stdout, job.stderr, job.exception, job.ip_addr, job.start_time, job.end_time) cluster.print_status()

我得到以下输出

2017-03-29 22:39:52 asyncoro -具有epoll I / O通知程序的版本4.5.2

2017-03-29 22:39:52 asyncoro - version 4.5.2 with epoll I/O notifier

2017-03-29 22:39:52 dispy-dispy客户端版本:4.7.3

2017-03-29 22:39:52 dispy - dispy client version: 4.7.3

2017-03-29 22:39:52 dispy-端口51347似乎已被另一个程序使用

2017-03-29 22:39:52 dispy - Port 51347 seems to be used by another program

然后什么也没有发生。
如何释放51347端口?

And then nothing happens. How to free the 51347 port?

推荐答案

如果您使用的是Linux,请运行 sudo netstat -tuanp |

If you are under Linux, run sudo netstat -tuanp | grep 51347 and take note of the pid using that port.

然后执行 ps ax | grep 51347 并记下使用该端口的pid。

Then execute ps ax | grep <pid> to check which service/program is running with that pid.

然后执行 kill< grep< pid> 来检查哪个服务/程序正在使用该pid运行。 pid> 终止使用该端口的进程。

Then execute kill <pid> to terminate the process using that port.

请先检查哪个进程正在使用该端口,然后再终止该端口,以防万一是您不应该杀死的东西。

这篇关于端口51347似乎已被另一个程序使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆