I have anaconda python distribution in ~/anaconda/bin/python
but what shebang can I use to call this version of python instead of the old one that is default on the server?
# /opt/python/bin/python2.7
is the one i've been trying
To add to the already accepted answer (and reply to 0xc0de's comment), I think we can use:
#!/usr/bin/env python
Then we need to activate the Conda
environment, or source the custom Python path that we want to use.
By doing so, #!/usr/bin/env
will find the right Python version, and also will make sure that the script will run correctly inside the virtual environment.
The rest of the first line after the shebang is parsed as an interpreter directive.
If you want your script to be interpreted / run by an specific binary you need to point to that binary after the shebang.
In this case you need to write something like this:
#!/home/yourusername/anaconda/bin/python