mac 下vscode配置python
- command + shift + P 输入task
- 打开第一个配置文件tasks.json
-
{ "version": "0.1.0", "command": "python", "isShellCommand": true, "args": ["${file}"], "showOutput": "always" }
- 新建一个test.py
- command + shift + B运行py文件
-
- 配置python debug
- 1、新建一个python项目
- 2、打开launch.json文件
- 3、修改lanuch.json文件为:
-
{ "version": "0.2.0", "configurations": [ { "name": "Python", "type": "python", "request": "launch", "stopOnEntry": true, "pythonPath": "${config:python.pythonPath}", "program": "${file}", "cwd": "${workspaceRoot}", "env": {}, "envFile": "${workspaceRoot}/.env", "debugOptions": [ "WaitOnAbnormalExit", "WaitOnNormalExit", "RedirectOutput" ] }, { "name": "PySpark", "type": "python", "request": "launch", "stopOnEntry": true, "osx": { "pythonPath": "${env:SPARK_HOME}/bin/spark-submit" }, "windows": { "pythonPath": "${env:SPARK_HOME}/bin/spark-submit.cmd" }, "linux": { "pythonPath": "${env:SPARK_HOME}/bin/spark-submit" }, "program": "${file}", "cwd": "${workspaceRoot}", "env": {}, "envFile": "${workspaceRoot}/.env", "debugOptions": [ "WaitOnAbnormalExit", "WaitOnNormalExit", "RedirectOutput" ] }, { "name": "Python Module", "type": "python", "request": "launch", "stopOnEntry": true, "pythonPath": "${config:python.pythonPath}", "module": "module.name", "cwd": "${workspaceRoot}", "env": {}, "envFile": "${workspaceRoot}/.env", "debugOptions": [ "WaitOnAbnormalExit", "WaitOnNormalExit", "RedirectOutput" ] }, { "name": "Integrated Terminal/Console", "type": "python", "request": "launch", "stopOnEntry": true, "pythonPath": "${config:python.pythonPath}", "program": "${file}", "cwd": "", "console": "integratedTerminal", "env": {}, "envFile": "${workspaceRoot}/.env", "debugOptions": [ "WaitOnAbnormalExit", "WaitOnNormalExit" ] }, { "name": "External Terminal/Console", "type": "python", "request": "launch", "stopOnEntry": true, "pythonPath": "${config:python.pythonPath}", "program": "${file}", "cwd": "", "console": "externalTerminal", "env": {}, "envFile": "${workspaceRoot}/.env", "debugOptions": [ "WaitOnAbnormalExit", "WaitOnNormalExit" ] }, { "name": "Django", "type": "python", "request": "launch", "stopOnEntry": true, "pythonPath": "${config:python.pythonPath}", "program": "${workspaceRoot}/manage.py", "cwd": "${workspaceRoot}", "args": [ "runserver", "--noreload" ], "env": {}, "envFile": "${workspaceRoot}/.env", "debugOptions": [ "WaitOnAbnormalExit", "WaitOnNormalExit", "RedirectOutput", "DjangoDebugging" ] }, { "name": "Flask", "type": "python", "request": "launch", "stopOnEntry": false, "pythonPath": "${config:python.pythonPath}", "program": "fully qualified path fo 'flask' executable. Generally located along with python interpreter", "cwd": "${workspaceRoot}", "env": { "FLASK_APP": "${workspaceRoot}/quickstart/app.py" }, "args": [ "run", "--no-debugger", "--no-reload" ], "envFile": "${workspaceRoot}/.env", "debugOptions": [ "WaitOnAbnormalExit", "WaitOnNormalExit", "RedirectOutput" ] }, { "name": "Flask (old)", "type": "python", "request": "launch", "stopOnEntry": false, "pythonPath": "${config:python.pythonPath}", "program": "${workspaceRoot}/run.py", "cwd": "${workspaceRoot}", "args": [], "env": {}, "envFile": "${workspaceRoot}/.env", "debugOptions": [ "WaitOnAbnormalExit", "WaitOnNormalExit", "RedirectOutput" ] }, { "name": "Pyramid", "type": "python", "request": "launch", "stopOnEntry": true, "pythonPath": "${config:python.pythonPath}", "cwd": "${workspaceRoot}", "env": {}, "envFile": "${workspaceRoot}/.env", "args": [ "${workspaceRoot}/development.ini" ], "debugOptions": [ "WaitOnAbnormalExit", "WaitOnNormalExit", "RedirectOutput", "Pyramid" ] }, { "name": "Watson", "type": "python", "request": "launch", "stopOnEntry": true, "pythonPath": "${config:python.pythonPath}", "program": "${workspaceRoot}/console.py", "cwd": "${workspaceRoot}", "args": [ "dev", "runserver", "--noreload=True" ], "env": {}, "envFile": "${workspaceRoot}/.env", "debugOptions": [ "WaitOnAbnormalExit", "WaitOnNormalExit", "RedirectOutput" ] }, { "name": "Attach (Remote Debug)", "type": "python", "request": "attach", "localRoot": "${workspaceRoot}", "remoteRoot": "${workspaceRoot}", "port": 3000, "secret": "my_secret", "host": "localhost" } ] }
- 4、debug窗口就会出现python debug 字样,就可以直接debug了;
-
完毕!
相关推荐
Notes and code used in my [**Python and OpenCV course**](https://youtube/oXlwWbU8l2o) on [freeCodeCamp.org](http://freecodecamp.org). You can find me on [Twitter](https://twitter.com/jasmcaus) for ...
Visual Studio Code(简称VSCode)是一款广受欢迎的跨平台源代码编辑器,它支持多种编程语言,包括C和Python。对于开发者而言,能够有效地进行代码调试是提高开发效率的关键步骤。本篇将详细讲解如何在VSCode中设置...
首先,VSCode支持多种编程语言,包括但不限于C、C++、Java、Python、JavaScript等,这使得它成为一款多用途的代码查看工具。对于C和C++开发者来说,VSCode内置了对这两种语言的良好支持,包括语法高亮、自动完成、...
1. **多语言支持**:内置对JavaScript、TypeScript、Python、C++、Java等多种编程语言的语法高亮和智能代码补全,同时也支持通过扩展来增加对更多语言的支持。 2. **Git集成**:VSCode内建了强大的Git功能,包括...
It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as .NET ...
houdini的内置编辑器中的vex或python的代码推送到vscode上。自动配置的语法高亮和自动补全。 安装方法: Go to you $HOME/Houdini16.0 folder ( for instance, on windows: C:\Users\%USERNAME%\Documents\...
准备工作 ...查看Visual Studio Code Tips and Tricks,快速熟悉VSCode。 用户界面 了解VSCode用户界面,如下图所示,随便点一点,还是比较一目了然的。 快捷键 Windows下的默认快捷键如下图所示,万能C
结合标签“Python开发-其它杂项”,我们可以推测这可能是一个非官方、开源的Python开发工具,属于Python开发工具的“杂项”类别,即它不是像PyCharm或VSCode这样的主流IDE,但依然可以作为一个辅助学习的工具。...
2. **安装必要的插件**:如PyCharm中的Python插件、VSCode中的Python扩展等,这些插件可以帮助提高开发效率。 #### 三、Python基础语法 **3.1 变量与数据类型** - **变量声明**:Python采用动态类型系统,无需...
1. **语言支持**:VSCode通过扩展可以支持几乎所有的编程语言,如JavaScript、TypeScript、Python、Java、C++、C#、Go、Rust等。例如,`Prettier - Code formatter`用于代码格式化,`ES7 React/Redux/React-Native/...
在Vscode中选择对应的串口号,然后点击工具栏上的“Build and Flash”按钮即可完成编译并上传至ESP32设备。 4. **查看串口输出** 启动串口工具,设置波特率为115200,连接到ESP32开发板对应的串口号。运行程序后...
Python的IDLE(集成开发环境)也可用于编写和运行Python脚本,或者你可以选择其他的第三方IDE,如PyCharm、VSCode等,它们提供了更丰富的开发功能和扩展支持。 Python 3.6.4还对性能进行了优化,包括更快的字典查找...
- 推荐使用像VSCode、PyCharm这样的集成开发环境(IDE)。 - 对于简单的脚本编写,也可以使用Notepad++或Sublime Text等文本编辑器。 - **使用源文件**: - 将Python代码保存为`.py`文件,便于管理和复用。 - **...
2. **IDE与编辑器**:PyCharm、VSCode、Sublime Text等集成开发环境提供了丰富的功能,便于编写和调试Python代码。 九、持续学习 Python的生态系统不断发展,持续学习新的库和框架至关重要。Python社区活跃,有...
37. **and-or技巧**:在Python中,`and`和`or`可以用作逻辑短路操作,提高代码效率。 38. **元组**:元组是不可变序列,通常用于存储一组不可变的数据,如函数返回多个值时使用。 39. **数学运算**:Python支持...
- 推荐使用VSCode、PyCharm等支持Python的IDE。 - 也可以选择轻量级文本编辑器如Sublime Text、Atom等。 - **使用源文件**: - 将Python代码保存为`.py`扩展名的文件。 - 可通过命令行运行这些文件:`python ...
- 常见Python IDE(如PyCharm、VSCode等)的特点与优势; - 在IDE中创建新的Python项目; - 设置编码、调试工具等基本配置。 - **【Python第4课】输入** - **主要内容**:教授用户如何通过Python获取输入。 - ...
使用Python和Django构建Restuarnt网站 从这里获取课程: : ... 我将向您展示如何免费下载和安装所需的所有内容(Django,Python和VSCode)。 除此之外,您只需要一台具有Internet访问权限的计算机即可! 我需要知道
【Python 第3课】IDE(集成开发环境)的介绍,如PyCharm、VSCode、Jupyter Notebook等,它们提供了代码编辑、运行、调试的一体化环境,大大提升了编程效率。 【Python 第4课】输入,讲解了input()函数,允许用户在...