擅长:python、mysql、java
<p>在端口上终止进程的最简单方法是使用python库:freeport(<a href="https://pypi.python.org/pypi/freeport/0.1.9" rel="nofollow noreferrer">https://pypi.python.org/pypi/freeport/0.1.9</a>)。一旦安装,只需:</p>
<pre><code># install freeport
pip install freeport
# Once freeport is installed, use it as follows
$ freeport 3000
Port 3000 is free. Process 16130 killed successfully
</code></pre>
<p>实现细节可以在这里获得:<a href="https://github.com/yashbathia/freeport/blob/master/scripts/freeport" rel="nofollow noreferrer">https://github.com/yashbathia/freeport/blob/master/scripts/freeport</a></p>