Reputation: 1884
How do I run a python script with python 3.7 by using this syntax: ./main.py?
./main.py
By default, it runs with python 2.7 and thus I'm forced to run the script with python3 ./main.py
python3 ./main.py
I am on MacOS.
Upvotes: 0
Views: 146
Reputation: 311188
You could place a shebang on the first line of the file to make it executable (by python3):
#!/usr/bin/env python3
Upvotes: 3