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

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

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

netstat -ano|findstr "8888"

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

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

tasklist|findstr "15044"

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

taskkill /f /t /im python.exe

您可能感兴趣的与本文相关的镜像

Python3.11

Python3.11

Conda
Python

Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本

[I 10:22:05.842 NotebookApp] Writing notebook server cookie secret to C:\Users\PC\AppData\Roaming\jupyter\runtime\notebook_cookie_secret [E 10:22:05.843 NotebookApp] Failed to write cookie secret to C:\Users\PC\AppData\Roaming\jupyter\runtime\notebook_cookie_secret: [Errno 13] Permission denied: 'C:\\Users\\PC\\AppData\\Roaming\\jupyter\\runtime\\notebook_cookie_secret' [W 10:22:05.843 NotebookApp] Could not set permissions on C:\Users\PC\AppData\Roaming\jupyter\runtime\notebook_cookie_secret [I 10:22:06.192 NotebookApp] The port 8888 is already in use, trying another port. [I 10:22:06.192 NotebookApp] The port 8889 is already in use, trying another port. [I 10:22:06.192 NotebookApp] The port 8890 is already in use, trying another port. [I 10:22:06.192 NotebookApp] The port 8891 is already in use, trying another port. [I 10:22:06.193 NotebookApp] The port 8892 is already in use, trying another port. [I 10:22:06.193 NotebookApp] Serving notebooks from local directory: C:\Users\PC [I 10:22:06.193 NotebookApp] Jupyter Notebook 6.5.7 is running at: [I 10:22:06.193 NotebookApp] http://localhost:8822/?token=dc8615b3e075d637c2f7624c3da340a12428f1da9d89bd83 [I 10:22:06.193 NotebookApp] or http://127.0.0.1:8822/?token=dc8615b3e075d637c2f7624c3da340a12428f1da9d89bd83 [I 10:22:06.193 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [E 10:22:06.194 NotebookApp] Failed to write server-info to C:\Users\PC\AppData\Roaming\jupyter\runtime\nbserver-10712.json: [Errno 13] Permission denied: 'C:\\Users\\PC\\AppData\\Roaming\\jupyter\\runtime\\nbserver-10712.json' Traceback (most recent call last): File "C:\Users\PC\anaconda3\envs\ML\Scripts\jupyter-notebook-script.py", line 10, in sys.exit(main()) File "C:\Users\PC\anaconda3\envs\ML\lib\site-packages\jupyter_core\application.py", line 284, in launch_instance super().launch_instance(argv=argv, **kwargs) File "C:\Users\PC\anaconda3\envs\ML\lib\site-packages\traitlets\config\application.py", line 1075, in launch_instance app.start() File "C:\Users\PC\anaconda3\envs\ML\lib\site-packages\notebook\notebookapp.py", line 2358, in start self.write_browser_open_file() File "C:\Users\PC\anaconda3\envs\ML\lib\site-packages\notebook\notebookapp.py", line 2261, in write_browser_open_file with open(self.browser_open_file, 'w', encoding='utf-8') as f: PermissionError: [Errno 13] Permission denied: 'C:\\Users\\PC\\AppData\\Roaming\\jupyter\\runtime\\nbserver-10712-open.html'
最新发布
10-25
(base) D:\BaiduNetdiskDownload>jupyter notebook [I 2025-08-28 10:48:29.547 LabApp] JupyterLab extension loaded from D:\anaconda3\lib\site-packages\jupyterlab [I 2025-08-28 10:48:29.547 LabApp] JupyterLab application directory is D:\anaconda3\share\jupyter\lab [I 10:48:29.552 NotebookApp] The port 8888 is already in use, trying another port. [I 10:48:29.553 NotebookApp] The port 8889 is already in use, trying another port. [I 10:48:29.553 NotebookApp] The port 8890 is already in use, trying another port. [I 10:48:29.558 NotebookApp] Serving notebooks from local directory: D:\BaiduNetdiskDownload [I 10:48:29.558 NotebookApp] Jupyter Notebook 6.4.12 is running at: [I 10:48:29.558 NotebookApp] http://localhost:8891/?token=e9605add023b406ba4edbe3ae967c5e6d9e0241c7cee2de5 [I 10:48:29.558 NotebookApp] or http://127.0.0.1:8891/?token=e9605add023b406ba4edbe3ae967c5e6d9e0241c7cee2de5 [I 10:48:29.558 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 10:48:29.619 NotebookApp] To access the notebook, open this file in a browser: file:///C:/Users/%E5%BE%90%E5%9F%BA%E9%91%AB/AppData/Roaming/jupyter/runtime/nbserver-24212-open.html Or copy and paste one of these URLs: http://localhost:8891/?token=e9605add023b406ba4edbe3ae967c5e6d9e0241c7cee2de5 or http://127.0.0.1:8891/?token=e9605add023b406ba4edbe3ae967c5e6d9e0241c7cee2de5 [I 10:48:35.346 NotebookApp] 302 GET /?token=e9605add023b406ba4edbe3ae967c5e6d9e0241c7cee2de5 (::1) 1.000000ms [W 10:48:39.245 NotebookApp] Notebook 术语词库.ipynb is not trusted Bad file descriptor (C:\ci\zeromq_1616055400030\work\src\epoll.cpp:100) Bad file descriptor (C:\ci\zeromq_1616055400030\work\src\epoll.cpp:100)
08-29
(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
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值