Ubuntu16.04系统本身自带python2.7,可以保留不动,安装Anaconda3时将附带python3.6,不需要单独下载新的python版本。安装过程如下:
1.在Anaconda官网下载操作系统对应的版本
linux系统链接:https://www.anaconda.com/download/#linux
2.cd到下载目录中(一般放在/home/...中)
执行:chmod +x Anaconda3-5.2.1-Linux-x86_64.sh
./Anaconda3-5.2.1-Linux-x86_64.sh
执行到Do you accept the license terms?
选择yes继续
执行到install into this location:/home/.../anaconda3
按enter继续
执行到Do you wish the installer to prepend the Anaconda3 install location to PAYH in your /home/.../.bashrc?
选择yes继续
至此安装完成。
可能的问题:Warning:系统中已经存在一个python环境,可能会对一些操作产生影响(具体写的什么记不清了,大概意思就这样),此时在Terminal中输入python,仍然显示python2.7,并未变成python3.6.5 | Anaconda Inc,主要原因是在安装Anaconda时添加环境变量失败。
解决方法:重新打开一个Terminal,输入:sudo gedit /etc/profile,弹出profile文件,
在文件末尾添加:export PATH=/home/.../anaconda3/bin:$PATH(原则上就是将自己Anaconda的bin路径添加进去)。
保存后退出,然后reboot一下,重启后再输入python,python环境就自动切换到了python3.6.5.
参考博客:https://blog.youkuaiyun.com/chenhaifeng2016/article/details/78874883