使用cmd或powershell安装Python [英] Install Python with cmd or powershell

查看:102
本文介绍了使用cmd或powershell安装Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是,是否可以使用Powershell,cmd,vbs或Windows内置的任何其他语言安装python?如果已经问过这个问题,请把我重定向到答案.如何使用Windows命令提示符安装Python"介绍了如何在已安装exe的情况下安装python,而不是如何安装exe.

My question is if you can install python with powershell, cmd, vbs or any other language built into Windows already? If this was already asked please redirect me to the answer. "How to install Python using Windows Command Prompt" explains how to install the python if you already have the exe installed, not how to install the exe.

我正在尝试在未安装python的PC上使用文件安装python,唯一受限制的可能是该帐户不是管理员,如果可能的话,可能在后台.

I am trying to install python with a file on a pc that does not have python installed, only thing restricted might be that the account does not an administrator and if possible in the background.

推荐答案

您可以下载要安装的安装程序,然后在不使用安装程序UI的情况下自动安装它:

You could download the setup you want to install and then install it automatically without using the setup's UI:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Invoke-WebRequest -Uri "https://www.python.org/ftp/python/3.7.0/python-3.7.0.exe" -OutFile "c:/temp/python-3.7.0.exe"

c:/temp/python-3.7.0.exe /quiet InstallAllUsers=0 PrependPath=1 Include_test=0

虽然我认为没有管理员权限也无法运行,但我尝试使用 InstallAllUsers = 0 仅为当前用户安装它,但仍在要求提升权限.

I don't think it will work without admin privileges though, I tried using InstallAllUsers=0 to install it only for the current user but it is still asking for elevation.

以这种方式安装时,可以使用一些选项,这是文档: https://docs.python.org/3.6/using/windows.html#installing-without-ui

There are some options you can use when installing it this way, here is the doc: https://docs.python.org/3.6/using/windows.html#installing-without-ui

这篇关于使用cmd或powershell安装Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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