您的位置:首页 > 运维架构 > Linux

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

2016-06-07 10:55 603 查看
#-------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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  python linux 脚本