简体   繁体   English

如何在 VScode for Python 中将 PowerShell 终端更改为简单的终端?

[英]How can I change a PowerShell terminal to a simple one in VScode for Python?

I am new to VScode and want to run Python in it for my college project.我是 VScode 的新手,想在其中为我的大学项目运行 Python。 I have seen that in VScode all the programmes are executed in Windows PowerShell Terminal(By default).我已经看到,在 VScode 中,所有程序都在 Windows PowerShell 终端(默认情况下)中执行。 But the problem is that it also shows the file address which is being executed which I don't want.但问题是它还显示了我不想要的正在执行的文件地址。 So, please could you give a suggestion which software should be used in the terminal which only executes code and doesn't show any file address.所以,请你给一个建议,应该在终端中使用哪个软件,它只执行代码而不显示任何文件地址。 And How can I change it?我该如何改变它?

ctrl+shift+` is a Command Used to open terminal in VS code .. You can also Try Extension of python shell or powershell in VSCode ... 

VS code supports multiple shells. VS code 支持多个 shell。 By default it's powershell (PS >) on windows默认情况下,它是 windows 上的 powershell (PS >)

Click on "Select Default Profile" to change it (And restart VS code) or you can directly click on any of the available shells (shown in below pic).单击“选择默认配置文件”进行更改(并重新启动 VS 代码),或者您可以直接单击任何可用的 shell(如下图所示)。

About hiding the "file address" - you can always change the shell's corresponding settings file which it reads on load.关于隐藏“文件地址” - 您可以随时更改外壳在加载时读取的相应设置文件。

Ex: bash shell uses .bashrc settings file.例如:bash shell 使用 .bashrc 设置文件。 And how to hide file path could be checked here for bash : Show only current directory name (not full path) on bash prompt可以在此处为 bash 检查如何隐藏文件路径: 在 bash 提示符下仅显示当前目录名称(而非完整路径)

Similarly check how it's done for the shell you want同样检查它是如何为您想要的外壳完成的

在此处输入图片说明

You can try the extension of Code Runner , it will be like this:你可以试试Code Runner的扩展,它会是这样的:

在此处输入图片说明

Otherwise, you can change the value of "console" in the launch.json file to the internalConsole , then run the python file in the debug mode(F5), it will be like this:否则,您可以将launch.json文件中“console”的值更改为internalConsole ,然后以调试模式(F5)运行python文件,它会是这样的:

在此处输入图片说明

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我如何在没有终端命令的情况下运行 vscode 运行 python - how can i vscode run python without terminal command 如何使用 powershell/Windows 终端在 vscode 中调试(Python)程序? - How to debug (Python) programs in vscode with powershell/Windows Terminal? 如何使用一个python脚本打开Powershell终端? - How to open a powershell terminal with one python script? 如何在 ubuntu 18.04 上将 VSCode Python 解释器更改为 Linux 终端? - How do I change VSCode Python interpreter to Linux terminal on ubuntu 18.04? 当我在 VScode 中使用 python 在终端中写入时,我永远无法像教程那样在终端中写入。 我该如何解决? - When I write in the terminal using python in VScode i can never write in the terminal like the tutorials are doing. how do I fix that? Vscode 显示 Python 2.7.16 ... 我如何更改为 3.8? - Vscode shown Python 2.7.16... How can I change to 3.8? 如何让我的 vscode 终端将我的 venv 用于 python 而不是系统版本? - How can I get my vscode terminal to use my venv for python rather than the system version? 如何在 MacOS 中获取 VSCode 集成终端以启动正确版本的 Python? - How can I get VSCode integrated terminal in MacOS to launch correct version of Python? 使用 Python 时如何摆脱 Vscode 终端中显示的路径? - How can I get rid of the path shown in Vscode terminal while using Python? 在 VSCODE 中将 Python 终端从 Bash 更改为 CMD - Change the Python Terminal from Bash to CMD in VSCODE
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM