问题原文
原帖链接 · O.rka · CC BY-SA 3.0
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
社区高分解答
原帖链接 · IgNite · CC BY-SA 4.0
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.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
