我自己也遇到过这个问题,我在 .bat 中制作了我的启动器,因此您可以选择要启动的版本。
唯一的问题是您的 .py 必须在 python 文件夹中,但无论如何这里是代码:
对于 Python2
@echo off
title Python2 Launcher by KinDa
cls
echo Type the exact version of Python you use (eg. 23, 24, 25, 26)
set/p version=
cls
echo Type the file you want to launch without .py (eg. hello world, calculator)
set/p launch=
path = %PATH%;C:\Python%version%
cd C:\Python%version%
python %launch%.py
pause
对于 Python3
@echo off
title Python3 Launcher by KinDa
cls
echo Type the exact version of Python you use (eg. 31, 32, 33, 34)
set/p version=
cls
echo Type the file you want to launch without .py (eg. hello world, calculator)
set/p launch=
cls
set path = %PATH%:C:\Python%version%
cd C:\Python%version%
python %launch%.py
pause
将它们保存为 .bat 并按照里面的说明进行操作。