简体   繁体   English

如何在VSCode Python终端中循环到上一个命令

[英]How do I cycle to previous command in VSCode Python Terminal

In the integrated Power Shell terminal in VSCode in Windows 10, I can type a command, and then re-type it again at the prompt by pressing the up arrow key. 在Windows 10中VSCode的集成Power Shell终端中,我可以键入命令,然后按向上箭头键在提示符下再次键入它。

How do I get the same behavior in the integrated anaconda Python console? 如何在集成的Anaconda Python控制台中获得相同的行为?

This is a related question, though not applicable to the Python console. 是一个相关的问题,尽管不适用于Python控制台。

Here are the steps to replicate the issue: 以下是复制问题的步骤:

  1. Launch Anaconda Navigator, and select vscode 启动Anaconda Navigator,然后选择vscode
  2. Open .py file in vscode 在vscode中打开.py文件
  3. Run file ctrl + shift +F 运行文件ctrl + shift +F
  4. Go to terminal. 转到终端。 At prompt enter python 在提示符下输入python

PS C:\\Users\\Fred\\Desktop\\pandas> python Python 3.6.5 |Anaconda, Inc.| PS C:\\ Users \\ Fred \\ Desktop \\ pandas> python Python 3.6.5 | Anaconda,Inc. | (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. (默认值,2018年3月29日,13:32:41)[win32上的[MSC v.1900 64位(AMD64)]]键入“帮助”,“版权”,“信用”或“许可证”以获取更多信息。
>>> >>>

  1. At python prompt enter 2+2 + enter 在python提示符下输入2+2 +输入
  2. At python prompt enter up up arrow . 在python提示符下,输入up arrow Nthing happens. 什么也没发生。 Expected to get last command 2+2 . 预计将获得最后一个命令2+2

Neither the Python extension or VS Code play any part in that. Python扩展或VS Code都不起作用。 Instead, it has to do with what Anaconda provides with their Python interpreters (ie they must not be including readline ). 相反,它与Anaconda提供的Python解释器有关(即,它们一定不能包含readline )。

I would give ipython a try and see if that does what you are after. 我会ipython ,看看是否能满足您的要求。

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

相关问题 VSCode 中的 Python:如何运行之前的命令? - Python in VSCode: How do you run a previous command? 我如何在没有终端命令的情况下运行 vscode 运行 python - how can i vscode run python without terminal command 当我想通过终端运行特定命令时,如何使用VScode的调试器? - How do I use VScode's debugger when I want to run specific command through my terminal? 我如何从Python执行此终端命令? - How do I get this terminal command to be executed from python? 如何使用python向当前终端历史记录添加命令? - How do I add a command to current terminal history using python? 安装 VSCode for python 后如何清除命令提示符终端? - How to clear Terminal of command prompt after installing VSCode for python? 当我在 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? 如何在 ubuntu 18.04 上将 VSCode Python 解释器更改为 Linux 终端? - How do I change VSCode Python interpreter to Linux terminal on ubuntu 18.04? 如何在 VSCode 的终端中运行我的代码? - How do I run my code in the terminal in VSCode? 如何在 VScode for Python 中将 PowerShell 终端更改为简单的终端? - How can I change a PowerShell terminal to a simple one in VScode for Python?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM