如何在 Windows 上检查所有已安装的 Python 版本? [英] How can I check all the installed Python versions on Windows?

查看:55
本文介绍了如何在 Windows 上检查所有已安装的 Python 版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请注意,我不是问如何检查我安装了哪个版本的 Python".

Please note I'm not asking "how to check which version of Python did I install".

我在 Windows 计算机上安装了多个版本的 Python,例如 Python 2.7-64、Python 2.7-32 和 Python 3.7-32.

I've installed several versions of Pythons on my Windows computer, for example Python 2.7-64, Python 2.7-32, and Python 3.7-32.

Python 3 包含py"和pyw"这有助于我轻松启动不同的 Python,例如:

Python 3 includes "py" and "pyw" which helps me to easily start different Pythons, for example:

  • py -2.7"启动 Python 2.7-64
  • py -2.7-32"启动 Python 2.7-32
  • py -3.7-32"启动 Python 3.7-32

我想知道的是,如何检查我在 Windows PC 上安装了多少个不同版本的 Python 以及它们是什么版本?

What I'm wondering is, how to check how many different versions of Python did I install on my Windows PC and what versions are they?

PyCharm 能够找到它,但一方面,我不知道是否这是一个完整的列表,另一个,我想知道有没有Python提供的工具或操作系统可以做到这一点.

PyCharm is able to find it but, for one thing, I don't know if it is a complete list, and for another, I wonder if there is any tool provided by Python or the operating system can do it.

推荐答案

我刚刚得到答案.通过输入py -h"或py --help",我得到了帮助信息:

I just got the answer. By typing "py -h" or "py --help" I got the help message:

C:\Users\admin>py -h
Python Launcher for Windows Version 3.7.1150.1013

usage:
py [launcher-args] [python-args] script [script-args]

Launcher arguments:

-2     : Launch the latest Python 2.x version
-3     : Launch the latest Python 3.x version
-X.Y   : Launch the specified Python version
     The above all default to 64 bit if a matching 64 bit python is present.
-X.Y-32: Launch the specified 32bit Python version
-X-32  : Launch the latest 32bit Python X version
-X.Y-64: Launch the specified 64bit Python version
-X-64  : Launch the latest 64bit Python X version
-0  --list       : List the available pythons
-0p --list-paths : List with paths

这告诉我-0"(零,不是字母O")列出了可用的蟒蛇:

Which tells me that "-0" (zero, not letter "O") lists the available pythons:

C:\Users\admin>py -0
Installed Pythons found by py Launcher for Windows
 -3.7-64 *
 -3.7-32
 -2.7-64
 -2.7-32

虽然-0p"不仅列出了版本,还列出了路径:

While "-0p" lists not only the versions, but also the paths:

C:\Users\admin>py -0p
Installed Pythons found by py Launcher for Windows
 -3.7-64        C:\Users\admin\AppData\Local\Programs\Python\Python37\python.exe *
 -3.7-32        C:\Users\admin\AppData\Local\Programs\Python\Python37-32\python.exe
 -2.7-64        C:\Python27_64\python.exe
 -2.7-32        C:\Python27_32\python.exe

这篇关于如何在 Windows 上检查所有已安装的 Python 版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆