Is there any way to write a script and run it which asks the version of python being currently used, and if it's 2, install python3. Also is there any way to install pip using script in the similar way. New to python, sorry if there is any mistake.
-
1This is probably too broad for this site. The sheer number of potential cross-platform and environmental considerations is staggering. The answer can only be "maybe, depending on a bunch of things, and what the acceptable failure modes are".user1531971– user15319712017-10-14 12:51:59 +00:00Commented Oct 14, 2017 at 12:51
Add a comment
|
1 Answer
In general, the answer is no. First of all, you would have to answer hard questions like whether it is acceptable to install a new runtime on the user's computer, and whether they would appreciate that.
One option is to simply bundle the Python interpreter you need in your installer. Never rely on the user's installed Python, unless perhaps they ask you to. Another option is to make your programs compatible with both Python 2 and Python 3--for some programs this is not a ton of work.