Reputation: 11
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.
Upvotes: 1
Views: 32
Reputation: 249153
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.
Upvotes: 1