我试图右键单击该文件并重命名它,但它甚至不会向我显示扩展名,因此我可以将其删除。我也试过去属性,我也不能从那里做。我没有直接用 python 的 Tkinter 编码,我使用了我的书附带的定制图形库。
您是正确的,因为您只需要重命名它 - 不幸的是,现代版本的 Windows 默认隐藏扩展名,因此您无法轻易修改它。
I tend to set Windows to always display extensions (as this fixes this issue computer-wide), but if this is undesirable or not possible you can always use the command prompt:
cd C:\Path\To\File
ren MyPythonScript.py MyPythonScript.pyw
Run Code Online (Sandbox Code Playgroud)
Hope this helps.