2017-08-09 74 views
0

我已经安装了anaconda但没有添加到bashrc中。.bashrc保存导出

在终端I型:

export PATH="/home/my_pc/anaconda3/bin:$PATH" 

然后python一切运作良好。

Python 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:09:58) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux 
Type "help", "copyright", "credits" or "license" for more information. 
>>> 

但是当我关闭终端一切恢复旧的配置:

[email protected]_pc:~$ conda 
conda: command not found 
[email protected]_pc:~$ python 
Python 2.7.13 (default, Jan 19 2017, 14:48:08) 
[GCC 6.3.0 20170118] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> 

我怎么能保存新的出口路径配置?

回答

0

你应该添加到您的.bashrc.bash_profile文件:

export PATH="/home/my_pc/anaconda3/bin:$PATH" 
0

这应该为你做它:

# Permanent change that requires logging out 
echo 'export PATH="/home/my_pc/anaconda3/bin:$PATH"' >> ~/.bash_profile 

或者,如果你想:

# ~/.bashrc is sourced every time you launch a new terminal, so no need for logging out 
echo 'export PATH="/home/my_pc/anaconda3/bin:$PATH"' >> ~/.bashrc 
+0

它必须显示任何东西?我把第一个回声命令,但它似乎并没有工作 – neptunereach

+0

不,你不应该在屏幕上看到任何东西。第一种解决方案要求您注销并重新登录,并且(重要的)假设您登录时读取了〜/ .bash_profile文件。如果它不起作用,请使用第二种解决方案 - 它会在您启动新的Bash会话。 –