最近,我在15.04上安装了Anaconda3-2.5.0-Linux-x86_64.sh并最终完成了此任务!
:~$ python --version
Python 3.5.1 :: Anaconda 2.5.0 (64-bit)
:~$ python2 --version
Python 2.7.9
:~$ python3 --version
Python 3.5.1 :: Anaconda 2.5.0 (64-bit)
在安装的最后时刻,我确实yes
急着输入了一些内容,我想它必须对此做些什么。(好的,我的错,我应该仔细处理,但是现在我需要帮助,而不是批评)。
AFAIK这肯定会破坏其他程序。现在我该怎么做?
我认为可以的。
可以使用别名吗?
alias python=python2
但是我不确定。
我在VM中进行了安装,然后发生了以下情况。
/home/myuser/anaconda3
。At the end you'll be asked
Python 3.5.1 :: Continuum Analytics, Inc.
creating default environment...
installation finished.
Do you wish the installer to prepend the Anaconda3 install location
to PATH in your /home/myuser/.bashrc ? [yes|no]
[no] >>> yes
Prepending PATH=/home/myuser/anaconda3/bin to PATH in /home/myuser/.bashrc
A backup will be made to: /home/myuser/.bashrc-anaconda3.bak
To restore the old behavior, go to your home directory and do
mv .bashrc-anaconda3.bak .bashrc
then start a new shell.
As you suggest, you could alias python=python2
, but I find that a bit weird. I would
.bashrc
~/bin
ln -s ~/anaconda3/bin/python3 ~/bin/python3
$HOME/bin
to $PATH
](Should already be set by default by ~/.profile
)That way, calling python3
will start the one from Anaconda.
/usr/bin/python
is still there, and still points to python2.7
. The ramifications of having python->python3
in your path depend on how a specific script is called.
如果使用shebang #!/usr/bin/python
(就像Ubuntu附带的所有可执行文件中一样),则不会有任何变化。另一方面,#!/usr/bin/env python
有时会使用更好的可移植性,这将导致python3.5
被调用。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句