Visual Studio 代码终端 [英] Visual Studio Code Terminal

查看:45
本文介绍了Visual Studio 代码终端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在终端中使用打印命令运行 Python 代码时,没有任何反应.当我在终端中尝试 test.py 命令时,下面复制的文本就是输出.

When I try to run Python code in the terminal with a print command, nothing happens. When I try the test.py command in the terminal itself, the text copied below is what gets output.

请协助如何让终端打印我的代码.

Please assist in how to get the terminal to print my code.

E:\Kath\Documents\blockchain> test.py
test.py : The term 'test.py' is not
recognized as the name of a cmdlet, function,
script file, or operable program. Check the
spelling of the name, or if a path was
included, verify that the path is correct and
try again.
At line:1 char:1
+ test.py
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound:
    (test.py:String) [], CommandNotFoundExce
  ption
    + FullyQualifiedErrorId : CommandNotFound
   Exception

推荐答案

打开 VS Code 后,通过打开命令面板 (Ctrl+Shift+P) 选择 Python 3 解释器,然后开始键入 Python:选择 Interpreter 命令进行搜索,然后选择该命令.如果可用,您还可以使用状态栏上的选择 Python 环境"选项.现在,创建一个新文件,并使用扩展名 .py 保存它.完成此操作后,在工作区中编写所需的代码.然后右键单击工作区 --> 在终端中运行 Python 文件.这将运行选定的文件.希望此解决方案有所帮助.

Once you open the VS Code, select a Python 3 interpreter by opening the Command Palette (Ctrl+Shift+P), start typing the Python: Select Interpreter command to search, then select the command. You can also use the Select Python Environment option on the Status Bar if available. Now, create a new file, and save it with the extension .py. Once done this, write the required code in the workspace. And then Right Click on the workspace -->Run Python file in the terminal. This runs the selected file. Hope this solution helps.

这篇关于Visual Studio 代码终端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆