配置python执行环境:
在本地和远程都安装python插件
登录服务器免密码:
在服务器找到authorized_keys这个文件,将本地文件C:\Users\jie\.ssh\id_rsa.pub内的内容复制张贴到authorized_keys文件中。
launch里面的内容需要更改
安装各种插件
VSCode远程调试python2出错:
File "/root/.vscode-server/extensions/ms-python.python-2022.4.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_saved_modules.py", line 94, in <module>
import _thread as thread; verify_shadowed.check(thread, ['start_new_thread', 'start_new', 'allocate_lock'])
ImportError: No module named _thread
解决方案:
I think its the VS Code Python Extension. In VS Code select the Python Extension and select the Uninstall dropdown to install a previous version, the 2022.2.xxx fixed this issue.install previous version
参考链接:python - ImportError: No module named _thread - Stack Overflow
打开launch.json文件:
使用VSCode运行指定程序 launch.json,并且单步调试程序_大小曲奇(´ε` )的博客-CSDN博客_vscode打开launch.json
编译器输入多个参数,有些参数指定名称输入:
launch.json文件:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: 当前文件",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"args": [ "test", "--style_mode", "neg" ]
}
]
}
error: too few arguments
vscode编译器自身有bug,不能用小按钮来执行,要点最上面一栏的运行
环境不能选的问题:没有用于调试 python 的扩展。我们是否应在市场中找到 python 扩展
查看扩展中python的版本,可能被切换为预发布版本了
对于命令行运行成功的项目在vscode运行失败的解决方案
原因:当前执行路径在文件夹顶端,不在main.py所在的路径下
解决方案:更改launch文件中的cwd字段内容为main.py所在路径