【发布时间】:2020-12-21 09:37:12
【问题描述】:
我完全是 python 和 vscode 的新手;我想开始学习语言。但是,我卡住了,我什至没有开始:D
在终端中,在 Python3 中,import sysprint(sys.executable) 我得到了在 vscode 的设置中复制粘贴所需的路径(即,使用 python.pythonpath 到 JSON 文件的简单附加行)。
(1) 但是,当我运行一个简单的打印脚本时,vscode 中的终端会显示“默认的交互式 shell 现在是 zsh。要更新您的帐户以使用 zsh,请运行 chsh -s /bin/zsh。
更多详细信息,请访问..." 并要求输入密码。当我输入密码时,我收到一个冗长的连接错误:
hsh: Credentials could not be verified, username or password is invalid. Credentials could not be verified, username or password is invalid.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/xxx/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/launcher/__main__.py", line 95, in <module>
main()
File "/Users/xxx/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/launcher/__main__.py", line 51, in main
launcher.connect(host, port)
File "/Users/xxx/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/launcher/../../debugpy/launcher/__init__.py", line 34, in connect
sock.connect((host, port))
ConnectionRefusedError: [Errno 61] Connection refused
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/xxx/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/launcher/__main__.py", line 95, in <module>
main()
File "/Users/xxx/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/launcher/__main__.py", line 51, in main
launcher.connect(host, port)
File "/Users/xxx/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/launcher/../../debugpy/launcher/__init__.py", line 34, in connect
sock.connect((host, port))
ConnectionRefusedError: [Errno 61] Connection refused
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/xxx/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/launcher/__main__.py", line 95, in <module>
main()
File "/Users/xxx/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/launcher/__main__.py", line 51, in main
launcher.connect(host, port)
File "/Users/xxx/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/launcher/../../debugpy/launcher/__init__.py", line 34, in connect
sock.connect((host, port))
ConnectionRefusedError: [Errno 61] Connection refused.
我的名字是匿名的 xxx :)
(2) 当我尝试调试时出现以下错误:“调试配置中的 Python 路径无效。来源:Python(扩展)
这是 json 文件的样子:
{
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"tabnine.experimentalAutoImports": true,
"python.pythonPath": "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python"
}
知道如何克服这第一个大障碍吗?
非常感谢,
山姆
【问题讨论】:
-
欢迎来到 SO。请格式化您的帖子以使其可读。编辑器中的“代码示例”按钮可能会有所帮助。
标签: pythonpath