문제

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

도움이 되었습니까?

해결책

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

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top