Visual Studio Code is not showing the ouput of Python
Visual Studio Code is not showing the ouput of Python
回答1
Using the Python Extension Run/Debug commands
Notes
-
I recommend reviewing the official Visual Studio Code Python documentation and tutorial. That provides several of the basics, with running and debugging the "official" way.
-
There are multiple ways to configure built-in launches:
- When running or debugging Python in VS Code, there are a few options that you can change in your "launch.json" file. See this answer for more details.
Run or Debug with the built-in Python extension commands
You can run or debug using an icon and dropdown in the upper right of your editor window, when editing a python script file.
直接用这里的Run Python File,会在terminal里面执行Python文件,就可以看到输出了
You may need to setup a run/debug configuration to use this (see below), or it may automatically step you through creating one.
The output will normally go to a new "Python" terminal in the "terminal" window (Ctrl-` to open it). See this answer for how to change that behavior.
Setting up a run/debug configuration
Easy option:
- Use the menu item **
Run/Add Configuration
, and follow the prompts at the top of the VS Code window. - Some of the additional details are shown below.
More involved option:
- Click the run/debug icon on the left vertical icon toolbar.
- The window says "RUN AND DEBUG" at the top, with a drop-down that shows "No Configurations" for a given folder or workspace until you set this up.
- The gear to the right of the dropdown will have a red dot if you need to configure this:
Updated Image (1/2022) - Changed from just 'Debug' to 'Run and Debug':
- Click the gear icon (or in the menu, use Run/Open Configurations), and in the middle at the top, Visual Studio Code will open a window titled "Select a debug configuration".
- The available options will depend on exactly how you have Visual Studio Code setup and configured
- There should at least be a "Python File" option with the Python extension installed. Select it.
Now your debug configuration box on the top left of the debug pane should say "Python: Current File":
Visual Studio Code will add a file to your current workspace or working folder called .vscode/launch.json
, and opened it for edit.
相关文章
- Python 操作 Kafka --- kafka-python
- Python脚本扫描给定网段的MAC地址表(scapy或 python-nmap)
- Python脚本写端口扫描器(socket,python-nmap)
- Python中的函数
- How to run python interactive in current file's directory in Visual Studio Code? Python路径问题
- python魔法方法之-Python __repr__()方法:显示属性
- python 保存图片_用Python从视频中提取每一帧的图片
- error: Microsoft Visual C++ 14.0 is required问题最佳解决方法pip安装python包报错
- python清除数据库错误日志
- Python base64编码解码
- [转]python (matplotlib)画三维图像
- 请问Python零基础学会可以做哪些?python是不是很难学?
- 学python能做什么兼职-初学Python到月入过万最快的兼职途径(纯干货)
- 零基础自学Python需要多长时间从入门到精通?学python能兼职挣钱吗?怎么挣钱?
- 将自己OpenCV-Python-PyCharm开发环境的Python-3.6.8更换为python-3.9.10的详细过程记录
- 《python 与数据挖掘 》一1.3 Python开发环境的搭建
- vscode (Visual Studio Code) 配置Python 虚拟环境
- Microsoft Visual C++ Compiler for Python 2.7真正下载地址
- 《Python编程快速上手——让繁琐工作自动化》——2.11 习题
- 《Python 3程序开发指南(第2版•修订版)》——1.4 总结
- python模块导入细节
- Python split函数
- Python 数据分析教程之如何验证线性回归的假设,线性回归的假设是什么?以及如何用python验证它们?
- Python 教程之如何使用 matplotlib 在 python 中绘制数学函数
- python logging模块 basicConfig配置文件
- Jenkins持续集成实战之Jenkins构建Python项目提示:'python' 不是内部或外部命令,也不是可运行的程序。
- Python 基础 之 python 协程知识点整理,并实现一个简单 gevent 的协程并发图片下载的应用
- python第三十课--异常(with as操作)
- 【Python】模块详解/如何安装模块的方法
- python爬虫之多线程threading、多进程multiprocessing、协程aiohttp 批量下载图片
- Python Excel 合并
- Python 模板匹配 匹配一个 识别一个图形