【问题标题】:F2 rename variable doesn't work in vscode + jupyter notebook + pythonF2 重命名变量在 vscode + jupyter notebook + python 中不起作用
【发布时间】:2022-01-16 11:11:44
【问题描述】:

我可以在 vscode 的常规 python 文件中使用正常的 F2 重命名变量功能。但在 jupyter notebook 中编辑 python 时不会。

当我在 vscode 中的 jupyter 笔记本中的变量上按 F2 时,我会看到熟悉的更改变量窗口,但是当我按 Enter 时,变量没有更改,并且我收到以下错误消息:

没有结果。没有结果。

有没有办法让 F2 更改变量功能在 jupyter 笔记本中工作?

这是我的系统信息:

jupyter 模块版本

(adventofcode) C:\git\leetcode>pip show jupyter
Name: jupyter
Version: 1.0.0
Summary: Jupyter metapackage. Install all the Jupyter components in one go.
Home-page: http://jupyter.org
Author: Jupyter Development Team
Author-email: jupyter@googlegroups.org
License: BSD
Location: c:\users\johan\anaconda3\envs\adventofcode\lib\site-packages
Requires: ipykernel, qtconsole, nbconvert, jupyter-console, notebook, ipywidgets
Required-by:

Python 版本:

(adventofcode) C:\git\leetcode>python --version
Python 3.10.0

vscode 版本:

1.63.2 (user setup)

vscode Jupyter 扩展版本(来自扩展窗口中的更改日志):

2021.11.100 (November Release on 8 December 2021)

【问题讨论】:

    标签: python visual-studio-code jupyter-notebook jupyter


    【解决方案1】:

    注意到你在 GitHub 上提交了一个错误报告并看到了这个问题:Renaming variables didn't work,程序员回复了:

    笔记本目前不支持某些语言功能,但 我们现在正在制定计划,希望尽快将更多此类内容上线。

    所以请等待这个功能。

    【讨论】:

    • 是的,我首先在这里创建了问题,但意识到最好的地方是 vscode-jupyter github 页面。感谢您的回答。
    【解决方案2】:

    我可以通过以下方式重命名一个单元格中的变量:

    1. 选择变量
    2. 右键单击并选择“更改所有事件”
    3. 更改变量名

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-10-30
      • 2016-05-03
      • 2021-07-09
      • 1970-01-01
      • 2019-11-24
      • 2017-06-12
      相关资源
      最近更新 更多