在静默安装Python时添加到Path var中-可能的错误? [英] Adding into Path var while silent installation of Python - possible bug?

查看:79
本文介绍了在静默安装Python时添加到Path var中-可能的错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在应用程序包安装中被动安装Python,因此我使用以下内容:

I need to passively install Python in my applications package installation so i use the following:

python-3.5.4-amd64.exe /passive PrependPath=1

据此: 3.1.4.在没有UI的情况下安装我使用PrependPath参数,该参数应将路径添加到Windows环境变量中的Path中.

according this: 3.1.4. Installing Without UI I use the PrependPath parameter which should add paths into Path in Windows environment variables.

但这似乎行不通.变量不做任何更改.

But it seems not to work. The variables does not take any changes.

如果我手动开始安装,然后选中或取消选中添加到路径中的复选框,则一切正常.

If i start installation manually and select or deselect checkbox with add into Paths then everything works.

在清除当前安装时,也可以使用清晰安装进行相同的操作.不幸的是,我没有其他装有Win 10 Pro的PC对其进行测试.

Works same with clear installation also on modify current installation. Unfortunately i do not have other PC with Win 10 Pro to test it.

我也使用Python 3.6.3进行了测试,结果相同.

I have also tried it with Python 3.6.3 with same results.

还尝试使用PowerShell Start-Process python-3.5.4-amd64.exe -ArgumentList/passive,PretendPath = 1 获得相同的结果.

Also tried with PowerShell Start-Process python-3.5.4-amd64.exe -ArgumentList /passive , PretendPath=1 with same results.

也已在装有Windows 10的多台PC上进行了测试,结果相同,因此问题不仅出在单PC上

Also tested on several PCs with Windows 10, same results, so the problem is not just on single PC

当然,所有尝试都是以管理员身份进行的.

Of cource all attempts were run as administrator.

推荐答案

好吧,从我的角度来看,这似乎是Python Installer中的错误,我找不到任何使它工作的方法.

Ok, from my point of view it seems to be bug in Python Installer and I can not find any way how to make it works.

我发现了以下解决方法:

I have founds the following workaround:

使用py.exe,该文件是位于C:\ Windows的本地计算机上所有版本的Python的包装,因此,由于C:\ Windows是Path变量的标准内容,因此您可以在任何地方直接从CMD运行它.

Use py.exe which is wrapper for all version of Python on local machine located in C:\Windows so you can run it directly from CMD anywhere thanks to C:\Windows is standard content of Path variable.

py -3.5 -c "import sys; print(sys.executable[:-10])"

这会给我提供python 3.5安装目录.

This gives me directory of python 3.5 installation.

然后我通过以下方式将其手动设置为路径":

And then i set it into Path manually by:

setx Path %UserProfile%";PythonLocFromPreviousCommand

这篇关于在静默安装Python时添加到Path var中-可能的错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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