2017-08-09 27 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會話。 –