How do I find the name of the conda environment in which my code is running?

后端 未结 8 1686
耶瑟儿~
耶瑟儿~ 2020-12-08 18:48

I\'m looking for a good way to figure out the name of the conda environment I\'m in from within running code or an interactive python instance.

The use-case is that

8条回答
  •  半阙折子戏
    2020-12-08 19:33

    conda info
    

    directly lists all the information where in the first lines you can see the

    active environment: (some name)
    active env location: (location of active environment)
    

    I guess this is the most clear way.

    In an interactive environment like Jupyter Notebook or Jupyter Lab, you should use % before typing the commands, like the following,

    %conda info
    

提交回复
热议问题