简体   繁体   English

VSCode 中的向上箭头/上一个命令 Python Interactive 不工作

[英]Arrow up / previous command in VSCode Python Interactive not working

I'm working with VSCode on an Ubuntu 18.04 machine.我正在 Ubuntu 18.04 机器上使用 VSCode。 Everything is fine except that I can't get back to the previous command in Python Interactive Window via Arrow Up.一切都很好,除了我无法通过向上箭头返回 Python Interactive Window 中的上一个命令。 It works in the integrated terminal though, integrated shell is /bin/bash.它虽然在集成终端中工作,集成的 shell 是 /bin/bash。

I have no idea where this is coming from.我不知道这是从哪里来的。 I changed "keyboard.dispatch" to "keyCode", but that's not the problem.我将“keyboard.dispatch”更改为“keyCode”,但这不是问题所在。 I also tried different versions of the python-extension.我还尝试了不同版本的 python 扩展。

Do you have any idea?你有什么主意吗?

Thanks!谢谢!

Not sure if this is helpful for you as an Ubuntu user, but I came across the same problem in Windows this week.不确定这是否对您作为 Ubuntu 用户有帮助,但我本周在 Windows 中遇到了同样的问题。 In my case, the issue cropped up after I installed the Python extension in VS Code (or at least I didn't notice the issue before this).就我而言,问题是在我在 VS Code 中安装 Python 扩展后出现的(或者至少在此之前我没有注意到这个问题)。 The combination of using the Python extension, Git Bash for terminal, and python virtual environment killed the up arrow feature for me.使用 Python 扩展名、Git Bash 终端和 python 虚拟环境的组合为我杀死了向上箭头功能。 Using python outside a virtual environment works fine.在虚拟环境外使用 python 工作正常。 My solution was to use Command Prompt as the terminal when I wanted to use a virtual environment interactively.当我想交互式地使用虚拟环境时,我的解决方案是使用命令提示符作为终端。

In my situation, although I delete all the shortcuts of UpArrow, I still can get the previous command through UpArrow in Python interactive.在我的情况下,虽然我删除了 UpArrow 的所有快捷键,但我仍然可以通过 Python 交互中的 UpArrow 获取上一个命令。 This means there's no way to configure this shortcut, it was built in the plugin which built in Python extension.这意味着无法配置此快捷方式,它是内置在 Python 扩展插件中的插件中。

So it's some problem with your Python extension, but you said you have tried to install a different version of Python extension but still not work.因此,您的 Python 扩展存在一些问题,但您说您已尝试安装不同版本的 Python 扩展但仍然无法正常工作。 Make sure you have deleted it completely -> delete the extension folder manually(it's under C:\Users[UserName].vscode\extensions\ms-python.python-xxx).确保您已完全删除它 -> 手动删除扩展文件夹(它位于 C:\Users[UserName].vscode\extensions\ms-python.python-xxx 下)。

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

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