1. Usually when we write programs in Pycharm, we write #!/usr/bin/env python on the first line.
Such as:
#! /usr/bin/env Python3
#-*-coding:utf-8-*-
#Author xiaoxing
Print ("Hello world!")
The purpose here is to tell the operating system to invoke the Python interpreter when executing this script, in addition to preventing the operating system user from not loading python into the default /usr/bin path. When the system sees this line, it will first find the Python installation path in the env settings , and then call the interpreter under the corresponding path to complete the operation.
2. Also write in the first line of the #!/usr/bin/python(it only takes effect under the Linux system)
Such as:
#! /usr/bin/python3
#-*-coding:utf-8-*-
#Author xiaoxing
Print ("Hello world!")
The goal is to tell the operating system to invoke the python interpreter under/usr/bin when executing this script . However, if there is no python interpreter under the path , the program will error, so it is recommended to use the first
The first line of the Python program #!/usr/bin/env Python's role