How do I check how many versions of Python I have installed on my device using the cmd prompt?

martin

New Member
#1
I have Anaconda and Spyder, which I know use Python 3.6.5 and 3.6.6, alongside Python 3.7.0. How do I check how many version of python I have installed using the Windows Command Prompt?
 

Admin

Administrator
Thành viên BQT
#2
The python launcher (r"C:\WINDOWS\py.exe") has a list command: py.exe -0 It displays all installed python versions. If all you want is a visual list, that works alone. In a batch script, however, you might want to count the versions:
Mã:
setlocal enableDelayedExpansion
set pyvcount=0
for /f %G in ('%SYSTEMROOT%\py.exe -0') do set /a pyvcount+=1
Unfortunately, the I cannot figure out how to stop the command from printing Installed Pythons found by py Launcher for Windows to the console.
 
Top