0

I run python 3, mostly under linux but shall work with windows also.

Without conda, the shebang line is

   #! /usr/bin/python3

giving the location of the python interpreter. But what if i use conda??? Then the interpreter depends on the environment.... But how can i manage that my script runs in any environment??

There seems to be a variable in conda, $CONDA_DEFAULT_ENV holding the environment. If i have activated sth but base the interpreter is e.g. in

/home/ernst/.conda/envs/$CONDA_DEFAULT_ENV/bin/python

but for base it is just /opt/conda/bin/python on linux. Well how to get all this under a hood also platform transparent??

user2609605
  • 419
  • 2
  • 14

1 Answers1

1

You can use #!/usr/bin/env python3 -- in which case it'll use whichever python it'll find in the path first. So, if your default python is conda - then that's what'll be executing this script.

Why is #!/usr/bin/env bash superior to #!/bin/bash?

avloss
  • 2,389
  • 2
  • 22
  • 26