I'm trying to make my
.py files executable so I can run them using
./filename.py, but its not working for me.
What I did was adding the shebang
#!/usr/bin python3 and used the command
chmod +x filename.py. When I run
./filename.py then as normal user, I get the error message below
bash: ./filename.py: /usr/bin: bad interpreter: Permission denied
As superuser, it tells me this instead:
sudo: unable to execute ./filename.py: Permission denied
Opening the file the usual method (
python3 filename.py) it works fine.
When I changed the shebang to
#!/usr/bin/env python3 it tells me this:
/usr/bin/env: ‘python3\r’: No such file or directory