Adding into Path var while silent installation of Python - possible bug?
Asked Answered
T

5

7

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

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.

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

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

EDIT:

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

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

EDIT: Of cource all attempts were run as administrator.

Tarpon answered 15/11, 2017 at 15:11 Comment(5)
but it works for me ... on a windows 7 32bit box.Aridatha
@Aridatha at Win 10 Pro not.Inventor
where is your codes ?Voter
@IvanBarayev what code?Inventor
Still bugged Python 3.8Mackie
T
3

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:

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])"

This gives me directory of python 3.5 installation.

And then i set it into Path manually by:

setx Path %UserProfile%";PythonLocFromPreviousCommand
Tarpon answered 27/11, 2017 at 7:50 Comment(0)
P
1

try powershell to do that

Start-Process -NoNewWindow .\python.exe /passive
Prepossession answered 24/11, 2017 at 2:5 Comment(3)
How can i add the PrependPath=1 argument? Start-Process python-3.5.4-amd64.exe /passive works but at Start-Process python-3.5.4-amd64.exe /passive PrependPath=1 I have got the following error: Start-Process : A positional parameter cannot be found that accepts argument 'PrependPath=1'.Inventor
you can try Start-Process -NoNewWindow .\python.exe -ArgumentList passive , PretendPath=1Prepossession
.\python.exe -ArgumentList PrependPath=1 is what I was looking for. (PrependPath takes a p.)Inhalator
P
0

Make sure you are using an elevated command prompt (ie: run as administrator).

Piragua answered 24/11, 2017 at 18:26 Comment(0)
B
0

Have you tried to use the InstallAllUsers argument. By default it is set >to 0 so try to use it like this (which is the same example from [here][1]):

python-3.6.0.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0 it migth make a difference to use the /quiet over /passive

[1]: https://docs.python.org /3.6/using/windows.html#installing-without-ui "the link you supplied"

To answer Erik Šťastný comment i believe that a good solution to your problem is to package python with your program to make sure that all the required libaries is preinstalled.

Brutalize answered 27/11, 2017 at 7:16 Comment(1)
it seems there is no difference over /quiet or /passive. InstallAllUsers=1 options is really bad. Because if someone has already installed Python in user profile, then is whole installation aborted before reach end and nothing is changed.Inventor
C
0

I also tried the command line options for the python installer and noticed the same issue as you, and here's the solution I found:

  1. Download the 64-bit installer from here: https://www.python.org/downloads/windows/ (the link is titled "Windows x86-64 executable installer")
  2. Uninstall any current python installation.
    • You can use this command: START python-3.8.3-amd64.exe /uninstall
    • (replace python-3.8.3-amd64.exe with the name of the file you downloaded).
    • (run cmd or your batch file as administrator, by right-clicking, then Run As Administrator).
  3. Install (as admin) python 64-bit for all users, with the START command:
    START python-3.8.3-amd64.exe /passive PrependPath=1 Include_pip=1 InstallAllUsers=1
  4. (Optional) Open a new cmd window to verify that python works from any location:
    • You can run this command:python --version
    • (If you don't see output like "Python 3.8.3", then Python has not been added to your PATH).
    • (Note: That command didn't work until I opened a new command prompt window).

For me, all of the details were important, so don't skip any.

Catholicize answered 5/6, 2020 at 22:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.