安装 Python 并使用 cmd 自动添加到路径

问题描述

有什么方法可以只用一个命令或一系列带有 bat 文件的命令来自动下载和安装 Python 并添加到路径中?

我尝试使用以下命令下载和安装:

下载安装程序:

curl https://www.python.org/ftp/python/3.7.9/python-3.7.9-amd64.exe -o python_install.exe

安装:

python_install.exe /passive InstallAllUsers=1 Prependpath=1 Include_test=0  Include_pip=1

但是即使在使用 Prependpath=1 之后,这也不会将 Python 添加到路径中。

解决方法

何不自己去官网下载Python试试?

  1. 从官网下载想要的python版本https://www.python.org/downloads/

  2. 然后打开文件,你会看到这样的图像,

    Python Installation

  3. 只需单击“将 Python 3.8 添加到 PATH”(就我而言)

这样就可以了,

  • 已安装的 Python

  • 添加到路径