【Linux】Linux下调用Python程序脚本

#-------linux下查看Python版本

yfy@yfy-H81M-DS2:~$ python --version
Python 2.7.6


#-------pyhton测试程序 test.py

#! /usr/bin/python  
for i in range(0,5) :  
       print i 

我的保存路径:/home/yfy/test.py


#------python脚本运行

------第一种方式:

yfy@yfy-H81M-DS2:~$ chmod +x test.py
yfy@yfy-H81M-DS2:~$ ./test.py
0
1
2
3
4

chmod  +x  test.py    ------给脚本增加执行权限 

------第二种方式:

yfy@yfy-H81M-DS2:~$ python test.py
0
1
2
3
4


猜你喜欢

转载自blog.csdn.net/coralime/article/details/51602206