第一天学习python执行python文件需要给文件权限

先写第一个python文件
hello.py

print('hello world')

然后运行,当然目录一定切换到文件目录下

localhost:Desktop liuxxx$ ./hello.py
然后输出如下
-bash: ./hello.py: Permission denied

喔,NO,权限权限啊
好吧给hello.py添加权限

localhost:Desktop liuxxxchmod a+x hello.py
然后执行
localhost:Desktop liuxxx ./hello.py
终于成功了输出如下
hello world
0 0 vote
Article Rating
Subscribe
提醒
guest
0 评论
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x