ubuntu16.04中设置python3为默认的,以及一些python3的库安装

利用alternatives机制更改python3为默认

shell中执行

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150

安装python3的包

  • Numpy sudo apt-get install python-numpy

  • Scipy sudo apt-get install python-scipy

  • Matplotlib sudo apt-get install python-matplotlib

  • Pandas sudo apt-get install python-pandas

  • statsModel sudo apt-get install python-statsmodels

  • scikit-learn sudo apt-get install python-sklearn

  • xgboost sudo -H pip install --pre xgboost

  • seaborn sudo pip install seaborn


如果要切换到python2,执行`sudo update-alternatives --config python`,然后在py2下安装的包,都是py2对应的安装包。