Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python 2 and Python 3 - Running in Command Prompt

Having various projects in both Python 2 and Python 3 (with both python versions installed), I was looking for a more intuitive way to run scripts via Command Prompt than py -3 script.py.

Python 2 already took python script.py, so ideally python3 script.py should invoke Python 3.

My question: How can I add python3 as a Command Prompt command?

like image 866
Jack Avatar asked Aug 03 '16 04:08

Jack


1 Answers

If Python 2 and 3 are both installed and in the PATH variable, you can do:

py -2

or

py -3

like image 102
Jérémie RPK Avatar answered Oct 11 '22 06:10

Jérémie RPK