在linux字元系統中安裝以下軟體
1. 安裝python +numpy+scipy+matplotlib(enthought成功)
2.安裝 R(成功)
3. 安裝gnuplot(安裝成功)
4. 安裝GSL
1.的安裝檔案
epd_free-7.3-2-rh5-x86_64.sh
安裝成功的測試指令碼
#-*-coding:gbk-*-
#########################################################################
# Copyright (C) 2013 All rights reserved.
#
# 檔案名稱:a.py
# 創 建 者:劉禹 finallyly
# 建立日期:2013年01月27日
# 描 述:
#
# 備 註:
#
#########################################################################
#!/usr/bin/python
# please add your code here!
import matplotlib
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
x=np.linspace(0,10,100);
plt.plot(x,np.sin(x));
fig.hold();
x=np.linspace(0,10,100);
plt.plot(x,0.5*np.cos(2*x));
plt.title("A matplotlib plot");
plt.text(1,-0.8,"cos func");
plt.ylim(-1.1,1.1);
fig.savefig('temp.png')
運行: liuyu: ~/MyTars/epd_free-7.3-2-rh5-x86_64/bin/Workbench$ ../python2.7 a.py
2.的安裝參加http://blog.sina.com.cn/s/blog_61f013b80100yhef.html,我安裝的版本是 R-2.15.2
2安裝成功運行
3. 安裝的版本是gsl-1.9,安裝的位置是liuyu: ~/GSL4. 安裝完上述四個開源庫後我的.bashrc內容如下
export PATH=$PATH:/home/liuyu/MyTars/epd_free-7.3-2-rh5-x86_64/bin
export PATH=$PATH:/home/liuyu/MyTars/R-2.15.2/bin
export R_HOME=/home/liuyu/MyTars/R-2.15.2/bin/R
export R_LIBS=/search/liuyu/MyTars/R-2.15.2/library
export LD_LIBRARY_PATH=${R_HOME}/lib:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH=/home/liuyu/GSL/lib:${LD_LIBRARY_PATH}
5. 源碼安裝軟體的方式
tar -xzvf source.tar.gz
cd source
./configure --prefix=dir//指定安裝目錄
make
make install
卸載 make uninstall
6.程式調用GSL庫(使用automake做編譯)
Makefile.am的內容
include $(top_srcdir)/common.mk
bin_PROGRAMS=
lib_LIBRARIES=
ib_LTLIBRARIES=
bin_PROGRAMS+=test
INCLUDES=-I /search/liuyu/GSL/include
test_SOURCES=test.cpp
test_LDADD= /home/liuyu/GSL/lib/libgsl.so /home/liuyu/GSL/li
b/libgslcblas.so
test_LDFLAGS=-static-libtool-libs
test.cpp的源碼
===============================================================* Copyright (C) 2013 All rights reserved.* * 檔案名稱:a.cpp* 創 建 者:劉禹 finallyly * 建立日期:2013年01月27日* 描 述:* 備 注: * 更新日誌:*================================================================*/ // please add your code here!#include<stdio.h>#include "gsl/gsl_vector.h"#include "gsl/gsl_matrix.h"#include "gsl/gsl_blas.h"#include "gsl/gsl_linalg.h"int main(){ double r; gsl_vector *a,*b,*s,*t; gsl_matrix *m,*v; a=gsl_vector_alloc(2); b=gsl_vector_alloc(2); gsl_vector_set(a,0,1.0); gsl_vector_set(a,1,2.0); gsl_vector_set(b,0,3.0); gsl_vector_set(b,1,6.0); gsl_vector_add(a,b); gsl_vector_fprintf(stdout,a,"%f"); gsl_blas_ddot(a,b,&r); fprintf(stdout,"%f\n",r); s=gsl_vector_alloc(2); t=gsl_vector_alloc(2); m=gsl_matrix_alloc(2,2); v=gsl_matrix_alloc(2,2); gsl_matrix_set(m,0,0,1.0); gsl_matrix_set(m,0,1,2.0); gsl_matrix_set(m,1,0,0.0); gsl_matrix_set(m,1,1,3.0); gsl_linalg_SV_decomp(m,v,s,t); gsl_vector_fprintf(stdout,s,"%f"); gsl_vector_free(a); gsl_vector_free(b); gsl_vector_free(s); gsl_vector_free(t); gsl_matrix_free(m); gsl_matrix_free(v); return 0;}
運行結果:
gnuplot安裝1. 下載wxGTK-2.8.12-i486-1alien.tgz,解壓後將libwx_gtk2u_richtext-2.8.so.0.8.0拷貝至/usr/local/lib(之所以放在這裡是因為/etc/ld.so.conf中指定了這個目錄為動態連結程式庫的功能目錄)2. 然後 進入源碼,以root身份安裝我的gnuplot源碼為gnuplot-4.6.rc1.tar.gz3. 之後配置bashrc中的path export PATH=$PATH:gnuplot的安裝目錄4.調用 檔案名稱plot.gp中有以下內容1 plot sin(x)
2 set grid
3 set xlabel "X"
4 set ylabel "Y"
5 set terminal png
6 set output "plot.png"
7 replotgnuplot plog.gp會在當前路徑下產生plot.png
f=scan(file="f3.txt");
quantile(f,0.01);
#png(file="myplot2.png", bg="transparent");
#boxplot(f);
fivenum(f);
summary(f);