【发布时间】:2019-05-23 10:51:42
【问题描述】:
说明:
我正在使用 Vscode Studio 进行 python 编码,我已经安装了所有与 python 相关的扩展,我想使用 Jupyter。我在导入包或运行代码时没有遇到任何问题,但是当我尝试从用户那里获取输入时,它会抛出一个错误,指出“StdinNotImplementedError:调用了 raw_input,但是这个前端不支持输入请求。”我没有使用控制台找到。
[图像错误] https://i.stack.imgur.com/BDUC5.jpg
错误
StdinNotImplementedError Traceback (most recent call last)
in
9 while 1:
10 #ask for new item
---> 11 new_item=input("> ")
12 #add new items to our list
13 shopping_list.append(new_item)
~\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ipykernel\kernelbase.py in raw_input(self, prompt)
846 if not self._allow_stdin:
847 raise StdinNotImplementedError(
--> 848 "raw_input was called, but this frontend does not support input requests."
849 )
850 return self._input_request(str(prompt),
StdinNotImplementedError: raw_input was called, but this frontend does not support input requests.
采取的步骤:
- 使用 raw_input 函数代替 input。
- 安装和卸载 python 和 jupyter 扩展。
- 检查了 jupyter notebook --version (5.7.4) 和 python -m ipykernel --version (7.2.0) 的版本。
- 重新启动内核但遇到同样的错误。
观察: 使用python集成终端执行代码时,该问题不可复制
如果有我遗漏的设置或者这是一个错误,请告诉我。
【问题讨论】:
-
请以正确的格式提问。
-
这里是a similar question,可能会有所帮助。它适用于 java,但在这里不应该相关。
-
@Joakim Danielson,谢谢,但此问题仅在使用 jupyter 功能时出现在 vs code studio 中,并且仅在有人使用输入命令输入时才会出现。
标签: python-3.x visual-studio-code jupyter