简体   繁体   中英

Need the full path when activating Conda environment?

I'm new to the Conda environment and I was trying to create an environment by conda create -n chip python=2.7 , and then source activate chip to activate the environment, but then I got the error message:

Could not find conda environment: chip
You can list all discoverable environments with `conda info --envs`.

And conda info --envs returned me:

# conda environments:
#
base                  *  /Users/yin/miniconda3
                         /anaconda3
                         /anaconda3/envs/chip

I tried source activate /anaconda3/envs/chip and it worked.
So can I add a name to my new environment (eg chip) so that I can activate it without typing the full path?
Thank you!

Rather than moving the environment around (which can cause issues), a better solution is to add the envs folder to the envs_dirs key-value list in .condarc , eg:

ssl_verify: true
channels:
  - defaults
envs_dirs:
  - C:\Users\<user>\Anaconda3\envs
  - D:\envs

Then all the environments will be available by their aliases in addition to their full paths. Answer shamelessly stolen from https://stackoverflow.com/a/56903431/1284670 .

How many conda installations do you have and how did you create the chip environment? Based on your output the path for the conda executable is pointing to the conda installation in /Users/yin/miniconda3 and it may not know about environments installed in other directory trees.

When you create a conda environment using conda create -n chip it should be created in the envs sub-directory of where your conda distribution is installed, ie, /Users/yin/miniconda3/envs/chip . Then you can refer to the environment by its name, ie, source activate chip .

When you create a conda environment using conda create -p the_env_path it will be created in the_env_path and you will have to refer to it by its path when using activate .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM