visual-studio-code - 如何在本地vscode中调试远程服务器上的python文件
问题描述
我可以通过 ssh 连接到我的远程服务器
$ssh -p ${port}root@${remoteIpAddress}
我在本地vscode中编辑源代码,并在安装了conda环境的远程服务器上运行我的项目,另外,我的本地电脑没有安装conda,也没有远程服务器的源代码。它工作得很好,但现在我想使用 vscode 的调试器在远程服务器中调试我的代码。我已经阅读了几个答案并创建了一个这样的 launch.json 文件:
{
"name": "Attach (Remote Debug)",
"type": "python",
"request": "attach",
"localRoot": "${workspaceFolder}",
"remoteRoot": "/my_project/project_name",
"port": ${port},
"secret": "my_secret",
"host": "localhost"
}
我运行项目
./file_name.sh --inference --checkpoint ${path_to_checkpoint} 0
并点击运行和调试按钮。它向我显示了这样的错误:
cd /run/user/10086/gvfs/sftp:host=${IpAdress},port=${port},user=root/root/my_project ; /usr/bin/env /bin/python3 /home/MyFolder/vietnt39/.vscode/extensions/ms-python.python-2021.9.1191016588/pythonFiles/lib/python/debugpy/launcher 45201 -- /run/user/10086/gvfs/sftp:host=${IpAddress},port=${port},user=root/root/my_project/project_name/src/experiments.py
-bash: ./file_name.sh: No such file or directory
/usr/bin/env: ‘/bin/python3’: No such file or directory
谁能知道这样做的正确方法?请帮我。我真的很感激!
解决方案
推荐阅读
- mysql - 无法在 Xampp 上打开 MySql 服务
- python - 从文本文件将元素附加到字典并将它们设置为无 [Python]
- python - 错误-系统找不到指定的路径:'data/train'
- airflow - 尝试从 XCom 传递值时,与 PostgresOperator 一起使用时,气流模板不呈现
- node.js - 与 MongoDB 的连接被拒绝
- java - 如何从netbeans将数据插入数据库?
- c# - 无论如何指向dbcontext中的特定位置行?
- r - 如果您正在编写的函数也具有可选参数,您如何使用 tidydots(...) ?
- json - Swift - 加载/解析 JSON 文件
- c# - 本地未发生的服务器上的 tiny_mce_wiris 错误