Python [Errno 98] Address already in use

前端 未结 9 2659
一个人的身影
一个人的身影 2020-11-27 10:35

In my Python socket program, I sometimes need to interrupt it with Ctrl-C. When I do this, it does close the connection using socket.close().

9条回答
  •  旧巷少年郎
    2020-11-27 10:48

    because you trying to run service in same port that is already running.

    some time its happen because your service is not stopped in process stack. you have to kill them

    no need to install anything here is the one line command to kill all running python processes.

    for Linux based OS:

    Bash:

    kill -9 $(ps -A | grep python | awk '{print $1}')
    

    Fish:

    kill -9 (ps -A | grep python | awk '{print $1}')
    

提交回复
热议问题