首页 > 解决方案 > ConnectionRefusedError: [WinError 10061] 无法建立连接,因为目标机器在使用 Python 时在 VS Code 上主动拒绝了它

问题描述

当出现上述错误时,我正在编写一个简单的 python 程序。

以前在使用VS Code编写 python 程序时也发生过这种情况。仅VS Code有问题吗?

有人可以帮忙吗?

这是弹出的完整错误: Traceback(最近一次调用最后一次):文件“C:\Users\user\AppData\Local\Programs\Python\Python38\lib\runpy.py”,第 194 行,在run_module_as_main return run_code (代码,main_globals,无,文件“C:\Users\user\AppData\Local\Programs\Python\Python38\lib\runpy.py”,第 87 行,run_code exec(code, run_globals) 文件“c:\Users \user.vscode\extensions\ms-python.python-2021.8.1105858891\pythonFiles\lib\python\debugpy\launcher_main .py”,第 97 行,在main
() 文件“c:\Users\user.vscode\extensions \ms-python.python-2021.8.1105858891\ pythonFiles \lib\python\debugpy\launcher_main
.py”,第 53 行,在主 launcher.connect(host, port) 文件“c:\Users\user.vscode\extensions\ms-python.python-2021.8.1105858891\pythonFiles\lib\python\debugpy\launcher/ ../..\debugpy\launcher_init .py",第 34 行,在 connect sock.connect
((host, port)) ConnectionRefusedError: [WinError 10061] 无法建立连接,因为目标机器主动拒绝了它

标签: pythonpython-3.xvisual-studio-code

解决方案


推荐阅读