怎么在linux里运行一个py文件?

怎么在linux里运行一个py文件?,第1张

#!/usr/bin/env python\x0d\x0a#注意上面这一行必须是第一行顶头写。\x0d\x0a# python file example. \x0d\x0a# assume we name this file as "hello.py"\x0d\x0a# use shell command "chmod +x hello.py" to make this file executable. \x0d\x0a# then you are able to run it by typing "./hello.py"\x0d\x0aprint "Hello this is from python!"

linux下python解释器的后缀有py、pyc、pyo、pyi、pyw、pyd、pyx等。实际上用python+文件的方式运行代码,只要文件内容相同,后缀名是不重要的,也就是说上面的运行结果都是等价。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/8320082.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-15
下一篇 2023-04-15

发表评论

登录后才能评论

评论列表(0条)

保存