解决“The port 8888 is already in use, trying another port”方法

本文介绍如何使用netstat和tasklist命令精确找出占用特定端口(如8888)的进程ID(PID),并通过taskkill命令强制停止该进程。示例中展示了一个实际操作流程,从定位到python.exe占用端口到最后成功终止进程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

精确找到被占用的端口对应的PID

netstat -ano|findstr "8888"

末尾显示的是PID得到端口号

接着,查看是哪个进程或程序占用了端口

tasklist|findstr "15044"

得到占用端口的进程为python.exe,调用命令停止它

taskkill /f /t /im python.exe
(cuda128) C:\Users\Administrator>Jupyter notebook [I 2025-07-11 13:18:37.260 ServerApp] jupyter_lsp | extension was successfully linked. [I 2025-07-11 13:18:37.270 ServerApp] jupyter_server_terminals | extension was successfully linked. [I 2025-07-11 13:18:37.281 ServerApp] jupyterlab | extension was successfully linked. [I 2025-07-11 13:18:37.291 ServerApp] notebook | extension was successfully linked. [I 2025-07-11 13:18:37.490 ServerApp] notebook_shim | extension was successfully linked. [I 2025-07-11 13:18:37.529 ServerApp] notebook_shim | extension was successfully loaded. [I 2025-07-11 13:18:37.532 ServerApp] jupyter_lsp | extension was successfully loaded. [I 2025-07-11 13:18:37.532 ServerApp] jupyter_server_terminals | extension was successfully loaded. [I 2025-07-11 13:18:37.536 LabApp] JupyterLab extension loaded from C:\Users\Administrator\anaconda3\envs\cuda128\Lib\site-packages\jupyterlab [I 2025-07-11 13:18:37.536 LabApp] JupyterLab application directory is C:\Users\Administrator\anaconda3\envs\cuda128\share\jupyter\lab [I 2025-07-11 13:18:37.537 LabApp] Extension Manager is 'pypi'. [I 2025-07-11 13:18:37.750 ServerApp] jupyterlab | extension was successfully loaded. [I 2025-07-11 13:18:37.754 ServerApp] notebook | extension was successfully loaded. [I 2025-07-11 13:18:37.756 ServerApp] The port 8888 is already in use, trying another port. [I 2025-07-11 13:18:37.757 ServerApp] The port 8889 is already in use, trying another port. [I 2025-07-11 13:18:37.757 ServerApp] The port 8890 is already in use, trying another port. [I 2025-07-11 13:18:37.757 ServerApp] The port 8891 is already in use, trying another port. [I 2025-07-11 13:18:37.759 ServerApp] Serving notebooks from local directory: C:\Users\Administrator [I 2025-07-11 13:18:37.759 ServerApp] Jupyter Server 2.16.0 is running at: [I 2025-07-11 13:18:37.759 ServerApp] http://localhost:8892/tree?token=6b2729b5dcb78b55a842581d80ad242dd28ef1884f07a3f8 [I 2025-07-11 13:18:37.759 ServerApp] http://127.0.0.1:8892/tree?token=6b2729b5dcb78b55a842581d80ad242dd28ef1884f07a3f8 [I 2025-07-11 13:18:37.760 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 2025-07-11 13:18:37.777 ServerApp] To access the server, open this file in a browser: file:///C:/Users/Administrator/AppData/Roaming/jupyter/runtime/jpserver-7272-open.html Or copy and paste one of these URLs: http://localhost:8892/tree?token=6b2729b5dcb78b55a842581d80ad242dd28ef1884f07a3f8 http://127.0.0.1:8892/tree?token=6b2729b5dcb78b55a842581d80ad242dd28ef1884f07a3f8 [I 2025-07-11 13:18:37.820 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server 以上什么问题,怎么解决
最新发布
07-12
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值