anaconda icon indicating copy to clipboard operation
anaconda copied to clipboard

Use Python Interpreter from the shebang line of a script

Open dufferzafar opened this issue 10 years ago • 3 comments

Can Anaconda use the interpreter mentioned in the Shebang line of a script?

#!/usr/bin/python3

# some code

dufferzafar avatar Jan 16 '16 18:01 dufferzafar

No it doesn't. That feature could be implemented but the overhead could be too much If several different interpreters are defined in the shebangs, apart from that, if someone opens a file with a shebang that doesn't exists in the system, anaconda will fail unable to start a JsonServer in order to lint, autocomplete, etc. So it is a bit risky as well

DamnWidget avatar Jan 18 '16 10:01 DamnWidget

How about a few "legal" shebangs? A key in settings that the user can customize which are the only allowed Python interpreters (python_interpreter can obviously be excluded from this list.. Or included, should not matter)

pradyunsg avatar Jan 26 '16 16:01 pradyunsg

@DamnWidget Any thoughts on this? @pradyunsg's legal shebangs sounds good too!

In a single project I have multiple python files, some of which use Python 2, while others use Python 3. I leave Py2 files as it is, but use a shebang line #!/usr/bin/env python3 for the Python 3 files.

dufferzafar avatar Dec 11 '17 20:12 dufferzafar