Activating conda environment with its full path

后端 未结 4 554
忘掉有多难
忘掉有多难 2021-01-04 04:11

Usually, we activate a conda environment with the command:

source activate env_name

Is it possible to activate conda environment with its f

相关标签:
4条回答
  • 2021-01-04 04:47

    Sure, this is a old question but writing the answer for folks returning to this page. When you create a conda environment with the prefix, you'll not be allowed to give it a name. Please follow the below steps so that you'll have name for your conda environment and can activate it directly by using the name rather than the full path.

    1. Navigate to the custom folder where you want to create the new environment.
    2. D:\condaEnvs>conda create --prefix=FastAI --> This creates a conda environment named FastAI
    3. D:\condaEnvs> conda config --append envs_dirs ‘D:\condaEnvs\FastAIEnv’ --> This will give a name to your newly created conda environment.

    With the new versions of conda, we dont have this issue anymore.

    0 讨论(0)
  • 2021-01-04 04:58

    Update for conda 4.4 and up:

    You need to specify the conda environment path to activate. The new conda activate command should not need the full path to an "activate script" any longer, since the command is now "built-in" to conda. So something like:

    conda activate (fullpath)/env-name-here
    

    should work.


    The command you have specified activates the root environment because you have not given conda an environment to activate, and root is the default. If you want to activate a particular environment, you can certainly do so with the full path to the activate script, for instance

    source (full path to main Anaconda directory)/bin/activate (fullpath)/env-name-here
                                                               ^^^^^^^^^^^^^^^^^^^^^^^^
                                                               You're missing this part
    
    0 讨论(0)
  • 2021-01-04 05:02

    yes, it does activates the default environment of anaconda.

    you can see the list of created or available environments by :

    conda env list
    

    don't understand, what was the answer you were looking for ?

    0 讨论(0)
  • 2021-01-04 05:11

    You can activate an environment that is not in your conda environment list by passing the path to the environment. For example you can create an environment in any directory you want with the -p argument. Like so:

    conda create -p /path/to/some/location/mytestenv/ python=3.5
    

    This will NOT show up in conda env list, but you can activate it with:

    source activate /path/to/some/location/mytestenv
    
    0 讨论(0)
提交回复
热议问题