今天把Anaconda升级了下,然后再用之前的环境就不行了:
1 2 3 4 |
$ source activate py3 EnvironmentNameNotFound: Could not find conda environment: py3 You can list all discoverable environments with `conda info --envs`. |
查看系统环境:
1 2 3 4 5 6 7 8 9 |
$ conda env list # conda environments: # /Users/mcj/anaconda3 /Users/mcj/anaconda3/envs/py3 /Users/mcj/anaconda3/envs/pytorch /Users/mcj/anaconda3/envs/tf /Users/mcj/anaconda3/envs/xjj base * /opt/anaconda3 |
原来是新的Anaconda更换了安装路径,导致旧的包名字无法识别,如果临时要用一下旧的包,可以直接:
1 |
conda activate /Users/mcj/anaconda3/envs/py3 |
如果想恢复旧环境名,可以添加一下路径:
1 |
conda config --append envs_dirs /Users/mcj/anaconda3/envs |
这样就正常了:
1 2 3 4 5 6 7 8 9 |
$ conda env list # conda environments: # /Users/mcj/anaconda3 py3 * /Users/mcj/anaconda3/envs/py3 pytorch /Users/mcj/anaconda3/envs/pytorch tf /Users/mcj/anaconda3/envs/tf xjj /Users/mcj/anaconda3/envs/xjj base /opt/anaconda3 |