Discuss / Python / mac上无法给予执行权限

mac上无法给予执行权限

Topic source

ForRealHH

#1 Created at ... [Delete] [Delete and Lock User]

输入

$ chmod a+x hello.py

后 终端出现

-bash: $: command not found

不知道这是什么问题 请求指教 谢谢

不要输入 $

chmod a+x hello.py 即可

$的含义是:出现在其后的是命令

ForRealHH

#3 Created at ... [Delete] [Delete and Lock User]

您好

我输入chmod a+x hello.py后

显示出chmod: hello.py: No such file or directory

我将hello.py文件保存在桌面是否正确?

小白一只 还望指教

鹿男2

#4 Created at ... [Delete] [Delete and Lock User]
chmod: hello.py: No such file or directory

一样的问题

AAAYuan___

#5 Created at ... [Delete] [Delete and Lock User]

我也是这个问题,请问解决了吗?这么怎么解?

我输入chmod a+x hello.py后

显示出chmod: hello.py: No such file or directory

有个笨办法,就是得输入密码: 直接在终端输入 sudo 拖入文件地址就成 如下: guoleideMacBook-Air:~ guolei$ sudo /Users/guolei/Desktop/guolei.py Password: hello,world! guoleideMacBook-Air:~ guolei$

_Ljj110719

#7 Created at ... [Delete] [Delete and Lock User]

no such file 意思是当前目录下没有你的 *.py 看当前目录 $ pwd

所以需要先cd到自己的 .py 文件的目录下,然后再 python .py

yang_hope

#8 Created at ... [Delete] [Delete and Lock User]

如果你保存到桌面了的话,先用$ pwd看一下当前目录是不是在桌面。不是的话,再输入cd desktop切换到桌面,然后python xxx.py


  • 1

Reply