简体   繁体   English

终端不接受视觉代码中的输入

[英]Terminal not accepting inputs in visual code

Iam new to python. So my code was working just fine, until I opened the same program a few hours later.我是 python 的新手。所以我的代码工作得很好,直到几个小时后我打开了同一个程序。 The language being used is Python , in Visual code .使用的语言是Python ,以可视代码表示。 This is a screenshot of the output terminal.这是output终端的截图。

The program prompts the user to either press 'M' or 'D'at the very beginning.该程序会在一开始提示用户按“M”或“D”。 However, when I do so, it dosen't register.但是,当我这样做时,它不会注册。 Not only 'M' or 'D', but any charater entered isn't accepted.不仅是“M”或“D”,而且不接受任何输入的字符。 I have code runner extension istalled.我安装了代码运行器扩展。 As mentioned above, the input was being accepted a few hours prior to this.如上所述,在此之前几个小时就接受了输入。 I installed visual code today itself, so it is the latest version.我今天自己安装了可视化代码,所以它是最新版本。 Please help.请帮忙。

Seems more like an issue/bug in Visual code.似乎更像是可视代码中的问题/错误。 Try to run the program externally by going to the folder, opening a console window and running it by entering python hello_world.py , then you see where the issue comes from.尝试通过转到文件夹在外部运行程序,打开控制台 window 并输入python hello_world.py运行它,然后您会看到问题出在哪里。

Edit: I don't use Visual Code personally, but this sounds similar to your problem: How to allow VS Code to take input from users?编辑:我个人不使用 Visual Code,但这听起来与您的问题类似: How to allow VS Code to take input from users?

It is not a python problem, maybe something with your VSCode or its extension, or your computer.这不是 python 问题,可能与您的 VSCode 或其扩展程序或您的计算机有关。 Try to do the next steps:尝试执行以下步骤:

  1. Reboot PC重启电脑
  2. Restart VSCode重启 VSCode
  3. Reinstall VSCode重新安装 VSCode
  4. Try to use Shell, there is an example尝试使用Shell, 有例子
  5. Try another PC尝试另一台电脑
  6. Try an online python console like this one试试 像这样的在线 python 控制台
  7. Install Linux instead of Windows安装 Linux 而不是 Windows

and so on.等等。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM