如何使用 Windows 命令提示符安装 Python
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46056161/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to install Python using Windows Command Prompt
提问by madasionka
Is it possible to install Python from cmd on Windows? If so, how to do it?
是否可以在 Windows 上从 cmd 安装 Python?如果是这样,该怎么做?
回答by Thomas Munk
https://docs.python.org/3.6/using/windows.html#installing-without-ui
https://docs.python.org/3.6/using/windows.html#installing-without-ui
Installing Without UI: All of the options available in the installer UI can also be specified from the command line, allowing scripted installers to replicate an installation on many machines without user interaction. These options may also be set without suppressing the UI in order to change some of the defaults.
To completely hide the installer UI and install Python silently, pass the /quiet option. To skip past the user interaction but still display progress and errors, pass the /passive option. The /uninstall option may be passed to immediately begin removing Python - no prompt will be displayed.
All other options are passed as name=value, where the value is usually 0 to disable a feature, 1 to enable a feature, or a path.
不使用 UI 安装:安装程序 UI 中的所有可用选项也可以从命令行指定,允许脚本安装程序在没有用户交互的情况下在多台机器上复制安装。也可以在不抑制 UI 的情况下设置这些选项以更改某些默认值。
要完全隐藏安装程序 UI 并静默安装 Python,请传递 /quiet 选项。要跳过用户交互但仍显示进度和错误,请传递 /passive 选项。可以传递 /uninstall 选项以立即开始删除 Python - 不会显示提示。
所有其他选项都作为 name=value 传递,其中值通常是 0 表示禁用功能,1 表示启用功能或路径。
回答by J.Wincewicz
Assuming that you have python-installer.exe
file you can run in in /passive
mode in administrator window. Without administrator privileges you will be prompted
假设您有python-installer.exe
文件,您可以/passive
在管理员窗口中以模式运行。没有管理员权限会提示你
Do you want to allow this app to make changes to your device?
您要允许此应用对您的设备进行更改吗?
Powershell example could be:
Powershell 示例可能是:
$installer = "C:/tmp/python-3.7.6-amd64.exe"
& $installer /passive InstallAllUsers=1 PrependPath=1 Include_test=0