VSCode配置python调试环境
VSCode配置python调试环境
很久之前的一个东东,翻出来看看
1.下载python解释器
python 3.6.3 for windows
安装到系统某个路径例如C:\Python36
最好添加到Path,也可以不加
2.在VSCode市场中安装Python插件

3.同样是打开一个文件夹,新建一个.py文件
4.同样是launch.json文件和tasks.json文件
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": false,//是否在第一条语句时程序停止,下面的这个选项都一样
"pythonPath": "C:/Python34/python",//可执行文件路径
"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": false,
"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": false,
"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": false,
"pythonPath": "${config:python.pythonPath}",
"program": "${file}",
"cwd": "",
"console": "externalTerminal",
"env": {},
"envFile": "${workspaceRoot}/.env",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit"
]
},
{
"name": "Django",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"pythonPath": "${config:python.pythonPath}",
"program": "${workspaceRoot}/manage.py",
"cwd": "${workspaceRoot}",
"args": [
"runserver",
"--noreload",
"--nothreading"
],
"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"
}
]
}
```
$$tasks.json$$
```
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"taskName": "echo",
"type": "shell",
"command": "C:\\Python34\\python",//Python可执行文件路径
"args": ["${file}"]
}
]
}
```
### 4.在用户设置里加两条
$$settings.json$$
```
"python.pythonPath": "C:\\Python34\\python" ,//路径
"python.linting.enabled": false,//忘了是什么东西了,反正有用
```
### 5.接下来是正式的调试了

默认是Python选项
按$<F5>$启动调试
然后在
中有一些东西就是这样
但是这个默认的$python$选项并不能由用户输入
所以有

这个和下面的那个都可以
这个Intergrated……的选项是下图的东东

其实这个可以直接

直接当成cmd来用同样可以由用户输入
然后那个External……的选项只不过是开了一个控制台窗口

2333……
剩下的可以自己试试
说不定有惊喜
翻出很久之前做的一道题目
用py3写的
刚刚一直在用的test.py就是用的这道题的代码
<br><br><br>
## 1080 两个数的平方和
基准时间限制:1 秒 空间限制:131072 KB 分值: 5
给出一个整数N,将N表示为2个整数i j的平方和(i <= j),如果有多种表示,按照i的递增序输出。
例如:$$N = 130,130 = 3^2 + 11^2 = 7^2 + 9^2$$ (注:3 11同11 3算1种)
### Input
一个数N($1 \leq N \leq 10^9$)
### Output
共K行:每行2个数,i j,表示$N=i^2+j^2(0\leq i \leq j)$。
如果无法分解为2个数的平方和,则输出$No Solution$
### Input示例
130
### Output示例
3 11
7 9
VSCode配置python调试环境的更多相关文章
- Win10下使用VSCode配置python运行环境
VSCode配置python运行环境 安装python 到官网下载python,直接安装即可,在安装过程中可以选择将python加入环境变量 安装VSCode 官网下载,直接安装 配置 安装pytho ...
- “笨方法”学习Python笔记(2)-VS Code作为文本编辑器以及配置Python调试环境
Visual Studio Code 免费跨平台文本编辑器,插件资源丰富,我把其作为Debug的首选. 下载地址:https://code.visualstudio.com/Download 安装之后 ...
- python之vscode配置开发调试环境
在vscode中下载python插件,下载量最多的就是 打开launch.json,把以下代码粘贴进去即可 { // 使用 IntelliSense 了解相关属性. // 悬停以查看现有属性的描述. ...
- vsCode配置C++调试环境
1.下载安装VSCode,安装mscpptools ,直接搜索c++,或者mscpptools 2.下载MinGW 安装好,一般默认安装到C:\MinGW 安装好后直接启动. 选择需要的gcc ,g+ ...
- VSCode 配置 Python 开发环境
一.环境准备 首先需要先安装好 Python 和 VSCode, 下载地址如下 VSCode Python 二.安装 Python 扩展 首先在VSCode上安装 Python 扩展,如图: 三.新建 ...
- VSCODE 配置远程调试环境
以下内容为本人的著作,如需要转载,请声明原文链接微信公众号「englyf」https://www.cnblogs.com/englyf/p/16691460.html 我的需求是,在Windows桌面 ...
- notepad++ 配置Python 调试环境 实用版
一. 安装python 1. 下载python 2.7版本并安装: 2. 在安装到自定义python的时候选择 add python to ptah项:
- vscode配置python调试仍然直接输出
工作目录不能放在python的安装目录下
- VSCode配置Python开发环境
https://blog.csdn.net/vinkim/article/details/81546333 https://zhuanlan.zhihu.com/p/31417084
随机推荐
- hdu 2059龟兔赛跑("01"背包)
传送门 https://www.cnblogs.com/violet-acmer/p/9852294.html 题解: 看到这个题,第一反应就是DP,因为对于每个充电站,都有两种选择,充电或不充电,和 ...
- 关于navicat远程连接mysql问题
如果你想连接你的mysql的时候发生这个错误: ERROR 1130: Host '192.168.1.81' is not allowed to connect to this MySQL serv ...
- (Catalan数 大数) Game of Connections poj2084
Language: Game of Connections Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 8837 Accept ...
- 使用ROP攻击绕过Windows的DEP
使用ROP攻击绕过Windows的DEP 基础知识 DEP DEP(Data Execution Prevention)意为数据执行保护,是Windows的一项安全机制,主要能够在内存上执行额外检查以 ...
- SQL Server sp_executesql介绍和使用
execute相信大家都用的用熟了,简写为exec,除了用来执行存储过程,一般都用来执行动态Sql sp_executesql,sql2005中引入的新的系统存储过程,也是用来处理动态sql的, 如: ...
- HDFS集群PB级数据迁移方案-DistCp生产环境实操篇
HDFS集群PB级数据迁移方案-DistCp生产环境实操篇 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 用了接近2个星期的时间,终于把公司的需要的大数据组建部署完毕了,当然,在部 ...
- Array map()方法
这里的map不是“地图”的意思,而是“映射”.“映射”就是原数组被“映射”成对应新数组. [].map()基本用法跟forEach类似. map()方法返回一个新数组,数组中的元素为原始数组元素调用函 ...
- Bellman-Ford算法:POJ No.3169 Layout 差分约束
#define _CRT_SECURE_NO_WARNINGS /* 4 2 1 1 3 10 2 4 20 2 3 3 */ #include <iostream> #include & ...
- python学习笔记9--日志模块logging
我们在写程序的时候经常会打一些日志来帮助我们查找问题,这次学习一下logging模块,在python里面如何操作日志.介绍一下logging模块,logging模块就是python里面用来操作日志的模 ...
- Java基础编程题——分别统计出其中汉字、英文字母、空格、数字和其它字符的个数
package com.yangzl.basic; import java.util.Scanner; /** * 分别统计出其中汉字.英文字母.空格.数字和其它字符的个数 * @author Adm ...