vscode(cursor)配置python环境,含远程调试

一、本地配置

1.1 安装python插件

1.2 配置python环境

在右下角就可以切换python环境,太简单了!

1.3 Debug说明

打断点直接开启!

在debug的过程中,还可以输入打印中间变量或者做一些测试

二、远程连接

2.1 下载远程工具

2.2 连接远程

下载后出现,这个图标,然后连接输入密码即可:

2.3 安装python插件

远端仍然要安装python插件

2.3 设置当前路径

代码里配置路径

2.4 远程访问免密

https://blog.csdn.net/qq_45956730/article/details/137601010

2.5 设置运行脚本参数

根目录下:.vscode/launch.json

如果没有就选择debug栏点这个配置:

  • launch.json的内容

    {
    "version": "0.2.0",
    "configurations": [
    {
    "name": "Python: 当前文件",
    "type": "debugpy",
    "request": "launch",
    "program": "libs/chatchat-server/chatchat/cli.py", # 运行文件
    "console": "integratedTerminal",
    "cwd": "/xxx/codes/langchain-chatchat-0.3.0", # 工作目录
    "justMyCode": true,
    "args": ["start", "-a"] # 运行参数
    }
    ]
    }

然后点运行:

2.6 设置环境变量

仍然是在前面的launch.json中增加内容:

复制代码
{
    "version": "0.2.0",
    "configurations": [
      {
        "name": "Python: 当前文件",
        "type": "debugpy",
        "request": "launch",
        "program": "cli.py",
        "console": "integratedTerminal",
        "cwd": "/xxx/codes/langchain-chatchat-0.3.0/libs/chatchat-server/chatchat",  
        "justMyCode": true,
        "args": ["start", "-a"],
        "env": {
                "CHATCHAT_ROOT": "/xxx/codes/langchain-chatchat-0.3.0/libs/chatchat-server/chatchat/data"
        } # 这里则是增加环境变量
      }
    ]
  }

然后仍然按照上述方式启动即可。

2.7 调试怎么看module里面的东西

"justMyCode": true, ==> false

2.8 如何格式化python代码

需要安装插件autopep8

相关推荐
岁岁岁平安1 天前
本机 MongoDB 注册系统服务、启用security认证
数据库·python·mongodb
程序员大雄学编程1 天前
用Python来学微积分30-微分方程初步
开发语言·python·线性代数·数学·微积分
我爱学习_zwj1 天前
App通信:HTTP与JSON全解析
python
机器学习ing.1 天前
U-Net保姆级教程:从原理到医学细胞分割实战(PyTorch版)!
人工智能·pytorch·python·深度学习·机器学习
yzx9910131 天前
基于Django的智慧园区管理系统开发全解析
后端·python·django
sunsunyu031 天前
视频转图片工具
python·音视频
软件开发技术深度爱好者1 天前
Python类中方法种类介绍
开发语言·python
HealthScience1 天前
vscode默认使用typora打开md(Markdown)文件、vscode中打开Markdown怎么默认使用typora打开
ide·vscode·编辑器
用户8356290780511 天前
使用Python合并Word文档:实现高效自动化办公
后端·python
冰淇淋@1 天前
idea启动项目报错java: OutOfMemoryError: insufficient memory
java·ide·intellij-idea