macOS在vscode配置python的开发环境(笔记

在vscode中下载插件

在这里插入图片描述

  1. 创建文件夹和文件
    在这里插入图片描述
  2. 在settings.json文件中添加
  // 调试Python代码(F5) //
  // Path to Python, you can use a custom version of Python 
  // by modifying this setting to include the full path.
  "python.pythonPath": "python3", // 直接用命令就好(因为zsh已经知道python3指的就是那个解释器)。你也可以更改为python3解释器的安装路径(但是我推荐你直接写python3)

3.在这里插入图片描述
4安装插件code runner (直接运行代码)
5在setting.json

  // Code Runner执行Python代码(⌘R) //
  "code-runner.executorMap": {
    "python": "python3",
  },
  // Whether to save the current file before running.
  "code-runner.saveFileBeforeRun": true, // run code前保存
  // Whether to save the current file before running.
  "code-runner.runInTerminal": true, // 设置成false会在"OUTPUT"中只读输出,无法输入数据
  // Whether to preserve focus on code editor after code run is triggered.
  "code-runner.preserveFocus": false, // 若为false,run code后光标会聚焦到终端上。如果需要频繁输入数据可设为false
  // Whether to clear previous output before each run.
  "code-runner.clearPreviousOutput": true, // 每次run code前清空属于code runner的终端消息,默认false
  // Whether to ignore selection to always run entire file.
  "code-runner.ignoreSelection": false, // 只跑选中的n行代码

6右键runcode

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值