写python脚本为什么要加上#!/usr/bin/python

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xiangshangbashaonian/article/details/82828715

#!/usr/bin/python

用来声明是python脚本

而不是shell脚本

加上后   我们在linux运行时就可以./test.py

如果不加的话  就会用shell的解释器来执行python脚本   那么当然会报错咯

当然还可以直接python test.py

猜你喜欢

转载自blog.csdn.net/xiangshangbashaonian/article/details/82828715