系统自带python2,通过annaconda3,使用python3:

1. cd Downloads/
2. wget https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh
3. chmod +x Anaconda3-5.0.1-Linux-x86_64.sh
4. ./Anaconda3-5.0.1-Linux-x86_64.sh
5. vim ~/.bashrc
    * append "export PATH=$PATH:$HOME/anaconda3/bin" at last   ## 设置环境变量时,新安装的anaconda3的地址最好放在最后,因为centos7有些系统服务会使用到系统自带的python2
6. source ~/.bashrc

if you are the 'root':
7. do the above 1~5 steps
8. vim /etc/profile
    * append "export PATH=$PATH:/root/anaconda3/bin" at last
9. source ~/.bashrc
10. cd /usr/bin
11. ln -s /root/anaconda3/bin/python3.6 python3 ## 创建一个软连接,这样调用python3时,会启动anaconda内的程序
12. chmod o+x /root

then every user can use 'python3' directly

posted on 2018-04-25 17:44  SimbaStar  阅读(193)  评论(0编辑  收藏  举报