当使用静默安装程序 (.msi) 在 Windows 上安装 python 2.7 时,是否有命令行选项将 Python 添加到路径环境变量,如 GUI 选项?
Python 3.5 安装程序默认包含一个选项 PrependPath=0,但是 Python 2.7 可以使用它吗?
https://docs.python.org/3/using/windows.html
这里似乎讨论了这个问题,但没有针对 Python 2.7 的解决方案?
https://bugs.python.org/issue3561
编辑
这个批处理命令太棒了!!!
setx\M PATH "%PATH%;C:\Python\Python27;C:\Python\Python27\Scripts"
但 setx 会将存储的 %PATH% 字符串截断为 1024 字节。
最佳答案
自 2.4 起,Python MSI 安装程序可以更新系统路径。只需将 ADDLOCAL=ALL 添加到命令行即可。在传播之前,您必须重新启动系统。
msiexec /i "python-2.7.11.amd64.msi" /passive /norestart ADDLOCAL=ALL
关于python 2.7 windows silent installer (.msi) - 设置路径的命令行选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34214607/