0

On Terminal,

>> which python
/Users/Chois/.pyenv/shims/python

aa.py

# !/Users/Chois/.pyenv/shims python

print("a")

On Terminal,

chmod 755 aa.py

And execute it,

./aa.py

It occured errors

./aa.py: line 3: syntax error near unexpected token `"a"'
./aa.py: line 3: `print("a")'

What's wrong with it?

1
  • 1
    You're missing a / between shims and python in the hashbang (having a space instead), and have an erroneous space between # and ! Commented Mar 26, 2018 at 3:09

2 Answers 2

1

Rather than using full path for the python binary, your shebang line could use the env instruction. Then, your shebang line will end up being something like this:

#!/usr/bin/env python

Sign up to request clarification or add additional context in comments.

Comments

0

The shebang line is blatantly wrong... You shouldn't have a space between the hash and the bang:

#!/Users/Chois/.pyenv/shims/python

There's also a missing slash that I filled it for you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.