Salz
Salz

Reputation: 13

Which is the preferred way of installing up to date versions of Python using Powershell? Packaged binaries or online install?

I am attempting to create a tool that will run on PC's with unknown installs of Python. I've created a Powershell script to make sure an up-to-date version is being run so that the rest of the package can run smoothly as it is written in Python 3.7. My current working solution is this:

First it checks for any installed version of python, if it is determined that the version (if any is present) is below 3.7, this snippet runs:

`[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`

My question would be, is this the best way of doing this? Or would it be better to include Python binaries inside the package to circumvent any potential network issues. Thanks for any help or insight!

Upvotes: 1

Views: 72

Answers (1)

Marinus Bokslag
Marinus Bokslag

Reputation: 36

I prefer this solution as it decreases the size of the program overall by not preincluding python.

although its up to your user. if its a library aimed at extending python for other developers, than no need to include the binaries.

instead if this is meant to be standalone, it may be worth it to include the binaries.

although I still prefer what you have so it installs the most up to date version.

Upvotes: 0

Related Questions