1

I'm learning python and I'm attempting to make a python file executable. This is the code

#! /Users/<me>/PycharmProjects/untitled3 print ("Hello World") 

in the terminal I typed.

$ chmod +x paperclip.py 

And then

$ ./paperclip.py 

But I get

-bash: ./paperclip.py: /Users/<me>/PycharmProjects/untitled3: bad interpreter: Permission denied 

How do I fix this? Thanks.

Edit: Even after I changed the top line to

#!/Users/<me>/PycharmProjects/untitled3 python 

or

#! /Users/<me>/PycharmProjects/untitled3 python3 

Never mind. Thanks

3
  • the shebang is wrong. It should mention python. Can you try #! /usr/bin/env python instead? Commented Oct 1, 2016 at 21:55
  • 1
    #! /usr/bin/env python3 would likely be more appropriate since you're wanting Python 3 instead of the default Python 2. You can create a symlink if it's not already done by following the steps in this answer. Commented Oct 1, 2016 at 23:13
  • 1
    Use #!/usr/bin/python to use the OS X system python or a path to the interpreter you wish to use -- not the script path Commented Oct 2, 2016 at 2:17

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.