如何删掉文件右键edit with pythonwin

19 2025-11-21 09:49

要删除文件右键菜单中的 “Edit with PythonWin” 选项,通常是因为之前安装了 PythonWin(来自 PyWin32 扩展),它在注册表中添加了右键菜单项。你可以通过 手动修改注册表 来移除它。

✅ 方法一:手动删除注册表项(推荐)

🔍 步骤如下:

  1. Win + R,输入 regedit,回车 打开注册表编辑器。
  2. 导航到以下路径:
    HKEY_CLASSES_ROOT\SystemFileAssociations\.py\shell\Edit with PythonWin
     
    如果没有 .py 下的 shell\Edit with PythonWin,也可以检查:
    HKEY_CLASSES_ROOT\Python.File\shell\Edit with PythonWin
     
  3. 右键点击 “Edit with PythonWin” 这个文件夹(项),选择 删除
  4. 关闭注册表编辑器,刷新或重启资源管理器(或重启电脑)即可生效。

✅ 方法二:使用 .reg 文件自动删除(可选)

你可以创建一个 .reg 文件来删除该项:

📄 创建一个文件,命名为 remove_pythonwin_context.reg,内容如下:

reg
 
复制
Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\SystemFileAssociations\.py\shell\Edit with PythonWin]
 
然后双击运行它,确认导入即可。

⚠️ 注意事项:

  • 修改注册表前建议 备份注册表(文件 → 导出)。
  • 如果你使用的是 Python 虚拟环境Anaconda,可能还有其他右键菜单项,路径可能不同。
  • 如果你以后想恢复,可以重新安装 PythonWin 或手动添加回注册表。

✅ 验证是否成功

刷新资源管理器后,右键点击任意 .py 文件,确认 “Edit with PythonWin” 已消失。

全部评论

·