需要预先安装几个库:
1 sudo apt-get install build-essential gfortran libatlas-base-dev python-pip python-dev
另外numpy, scipy在virtualenv中安装时总是出错,具体跟liblapack-dev, libblas-dev这些依赖包相关。目前还没有找到比较好的解决方案,官方推荐的安装方法为
1 sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose
试了一下,在py3.4环境下安装scipy很顺利,只是需要的内存比较多,所以添加了2G的swap。
1 sudo mkdir /opt/images
2 sudo dd if=/dev/zero of=/opt/images/swap bs=1024 count=2048000
3
4 sudo mkswap /opt/images/swap
5 sudo swapon /opt/images/swap
6 pip install scipy
7
8 sudo swapoff /opt/images/swap
9 sudo rm -rf /opt/images/swap
2 sudo dd if=/dev/zero of=/opt/images/swap bs=1024 count=2048000
3
4 sudo mkswap /opt/images/swap
5 sudo swapon /opt/images/swap
6 pip install scipy
7
8 sudo swapoff /opt/images/swap
9 sudo rm -rf /opt/images/swap
人的一生只有两万来天,效率至上