yangruihan / blog

个人博客|Personal Blog
17 stars 2 forks source link

[Python] Windows 下多版本管理 #62

Open yangruihan opened 1 year ago

yangruihan commented 1 year ago

Windows 下多版本管理

官网上安装多个版本,比如

image

使用py命令代替python

使用 3.10:

py -3.10
Python 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

使用 3.9

py -3.9
Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

非常方便


下面是py命令说明(简化版)

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