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












1














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!










share|improve this question







New contributor




Salz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Instead of presuming the existence of C:temp and user rights to write there, you should IMO better use `$Env:temp`
    – LotPings
    Dec 27 '18 at 22:03










  • Although Windows is forgiving, you should use rather than / in paths
    – Remko
    Dec 28 '18 at 0:53


















1














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!










share|improve this question







New contributor




Salz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Instead of presuming the existence of C:temp and user rights to write there, you should IMO better use `$Env:temp`
    – LotPings
    Dec 27 '18 at 22:03










  • Although Windows is forgiving, you should use rather than / in paths
    – Remko
    Dec 28 '18 at 0:53
















1












1








1







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!










share|improve this question







New contributor




Salz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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!







python powershell






share|improve this question







New contributor




Salz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Salz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Salz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Dec 27 '18 at 18:01









Salz

83




83




New contributor




Salz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Salz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Salz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Instead of presuming the existence of C:temp and user rights to write there, you should IMO better use `$Env:temp`
    – LotPings
    Dec 27 '18 at 22:03










  • Although Windows is forgiving, you should use rather than / in paths
    – Remko
    Dec 28 '18 at 0:53




















  • Instead of presuming the existence of C:temp and user rights to write there, you should IMO better use `$Env:temp`
    – LotPings
    Dec 27 '18 at 22:03










  • Although Windows is forgiving, you should use rather than / in paths
    – Remko
    Dec 28 '18 at 0:53


















Instead of presuming the existence of C:temp and user rights to write there, you should IMO better use `$Env:temp`
– LotPings
Dec 27 '18 at 22:03




Instead of presuming the existence of C:temp and user rights to write there, you should IMO better use `$Env:temp`
– LotPings
Dec 27 '18 at 22:03












Although Windows is forgiving, you should use rather than / in paths
– Remko
Dec 28 '18 at 0:53






Although Windows is forgiving, you should use rather than / in paths
– Remko
Dec 28 '18 at 0:53














1 Answer
1






active

oldest

votes


















0














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.






share|improve this answer





















  • Thank you! It is intended for non-developers so i will keep that in mind!
    – Salz
    Dec 27 '18 at 18:24











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Salz is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53949071%2fwhich-is-the-preferred-way-of-installing-up-to-date-versions-of-python-using-pow%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














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.






share|improve this answer





















  • Thank you! It is intended for non-developers so i will keep that in mind!
    – Salz
    Dec 27 '18 at 18:24
















0














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.






share|improve this answer





















  • Thank you! It is intended for non-developers so i will keep that in mind!
    – Salz
    Dec 27 '18 at 18:24














0












0








0






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.






share|improve this answer












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.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 27 '18 at 18:06









Marinus Bokslag

262




262












  • Thank you! It is intended for non-developers so i will keep that in mind!
    – Salz
    Dec 27 '18 at 18:24


















  • Thank you! It is intended for non-developers so i will keep that in mind!
    – Salz
    Dec 27 '18 at 18:24
















Thank you! It is intended for non-developers so i will keep that in mind!
– Salz
Dec 27 '18 at 18:24




Thank you! It is intended for non-developers so i will keep that in mind!
– Salz
Dec 27 '18 at 18:24










Salz is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















Salz is a new contributor. Be nice, and check out our Code of Conduct.













Salz is a new contributor. Be nice, and check out our Code of Conduct.












Salz is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53949071%2fwhich-is-the-preferred-way-of-installing-up-to-date-versions-of-python-using-pow%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas