运行anaconda3 Jupyter notebook时提示环境错误:
"EnvironmentLocationNotFound: Not a conda environment: /home/xxx/.conda/envs/anaconda3 "
conda 版本4.4以后会出现,可以通过以下修复:
This is a confirmed bug in nb_conda for conda version >=4.4:
The reason is the change of conda info --json output. Fresh installation of version 4.3.33 gives envs=[], version >=4.4 gives envs=[root_env_dir] (always non empty).
修改这个文件:
~/anaconda3/pkgs/nb_conda-2.2.1-py36.0/lib/python3.6/site-packages/nb_conda/envmanager.py, 这里的(py36.0) 根据版本可能会有不同:
查找这一句:
return {
"environments": [root_env] + [get_info(env)
for env in info['envs']]
}
改成:
return {
"environments": [root_env] + [get_info(env) for env in info['envs']
if env != root_env['dir']]
}
重启 jupyter notebook server,错误提示消失。