centOS系统中将anaconda加入环境变量

在 Linux CentOS 系统上安装完 anaconda 后,为了使用方便,需要将 anaconda 命令加到系统命令中,如果在没有添加到环境变量之前,执行“conda”命令时,则会提示命令不存在的错误。

下面我详细介绍一下在 linux 下将 anaconda 加入到环境变量中的方法(anaconda安装在  /root/anaconda3/bin 目录下)。

该方法对所有系统用户生效,永久生效(网上还有很多方法,设置对当前会话有效/当前用户有效,等)

添加anaconda到系统环境变量:

输入命令:

vi /etc/profile



按【enter】键进入文件。

进入 /etc/profile 文件,在文件末尾加上如下两行代码 

PATH=$PATH:/root/anaconda3/bin  #路径名跟自己实际情况而定
export PATH

保存退出。

最后执行命令:

source /etc/profile
或执行点命令 ./profile 使其修改生效。

猜你喜欢

转载自blog.csdn.net/sxt1001/article/details/80628005