參考內容:https://docs.python.org/zh-cn/3.7/library/2to3.html
然後新建文件:python 2to3.reg
文件內容:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Python.File\Shell\editwithidle\shell\2to3\command]
@="cmd /c C:\\Users\\Joe\\AppData\\Local\\Programs\\Python\\Python37\\Tools\\scripts\\2to3.py -w \"%1\""
其中C:\\Users\\Joe\\AppData\\Local\\Programs\\Python\\Python37\\Tools\\scripts\\2to3.py 爲自己的文件路徑路徑。
找到自己python下的2to3.py 然後注意轉義。
保存好了直接雙擊
會有提示:
點擊確定
找到要轉換的程序,右鍵
選擇Edit with IDLE 然後選擇 2to3
然後就轉換成python3完成。
會在文件目錄同時生成該文件的.bak文件,這是該文件python2的備份文件。