Pergunta

I have a script for which I am trying to set up shebang so that I execute ./script.py instead of python script.py. This works for me when it is the topmost line of my script

#!/usr/bin/env python. This uses env.

when I tried to do change this, #/usr/local/lib/python2.7, I get this error message

/usr/local/lib/python2.7: bad interpreter: Permission denied

when I checked my python version, it is

>>> import sys
>>> sys.version
'2.7.3 (default, Jun 21 2013, 13:45:37) \n[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]'
>>> 

and sys.path gives /usr/local/lib/python2.7/*. Although I do not see anything specific for python2.7.3.

can you guide me as how to set up using pythonpath instead of env.

Thanks

Foi útil?

Solução

The shebang line should contain the actual python interpreter executable, not just a path to your python install. Probably can find the one you're looking for with which python

Outras dicas

which python on your command line should give you the path to the shebang line you need.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top