美文网首页
Set up scientific computing envi

Set up scientific computing envi

作者: flyingsoul | 来源:发表于2016-04-08 11:35 被阅读0次

1 Numpy

Install numpy
pip install numpy
Here, we may encounter a problem that says " Cannot compile 'Python.h'." Then we need to install the development version of python. Try using the following command
sudo apt-get install python-dev

2 Pandas

The procedure is the same as numpy.
pip install pandas

3 Matplotlib

pip install matplotlib
Here we encountered other problems. matplotlib has dependency on "freetype" and "pnglib". We need to install these packages.
sudo apt-get install pnglib-dev
For freetype, we have to download the source code and compile it.

#download
wget http://ftp.yzu.edu.tw/nongnu//freetype/freetype-2.6.3.tar.gz
#unzip
tar xvf freetype-2.6.3.tar.gz
#compile
cd freetype-2.6.3.tar.gz
./configure
make
sudo make install

4 Scipy

Build scipy need openblas and lapack packages.
During the compiling, there also need fortran compiler.

sudo apt-get install libopenblas-dev
sudo apt-get install liblapack-dev
sudo apt-get install gfortran

5 Jupter (ipython notebook)

pip3 install jupyter

Test the environment

Create a new python source file.

import numpy
import pandas
import matplotlib
#test code start here
a = np.random.randn(10)
df = pd.DataFrame(a)
plt.plot(df)
plt.show()

It works!

相关文章

网友评论

      本文标题:Set up scientific computing envi

      本文链接:https://www.haomeiwen.com/subject/wpjvlttx.html