首页 > 技术文章 > 【anaconda】激活环境失败-bash: activate:No such file/没有那个文件或目录

Tom-Ren 2018-11-10 21:45 原文

anaconda通常用于创建python虚拟环境,但环境变量有误时会出现无法激活的情况

在这里插入图片描述

1.添加环境变量

#出现这一问题的主要原因在于bash在环境变量中找不到activate这个命令了
#所以需要将环境变量写入
#环境变量一般在两个位置~/.bashrc和/etc/bash.bashrc  bash的设置
#~/.profile  /etc/profile  系统设置
#最方便的做法是export
export PATH="~/anaconda3/bin:$PATH"   #将PATH添加即可
source activate YourEnvs

2.conda activate

conda自带的activate命令可以直接调用conda下的环境路径,所以在无法用source激活时,可以选择:
conda activate YourEnvs
来激活python虚拟环境。

https://unsplash.com/photos/bW2vHKCxbx4
pic from unsplash


ref:
https://blog.csdn.net/xiangyong58/article/details/73650105
https://jingyan.baidu.com/article/cd4c297936a220756e6e60df.html
conda:
https://www.anaconda.com/
https://conda.io/miniconda.html
https://cloud.tencent.com/developer/article/1351778

推荐阅读