How do I run a python script with python 3.7 by using this syntax: ./main.py
?
By default, it runs with python 2.7 and thus I'm forced to run the script with python3 ./main.py
I am on MacOS.
您可以将shebang放在文件的第一行以使其可执行(通过python3):
#!/usr/bin/env python3
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.