* 参考ISCE发布包自带的readme.txt说明。*
从网络上下载到的源码包, 最常见的是 .tar.gz 包, 还有一部分是 .tar.bz2包,要解压很简单 :
.tar.gz 格式解压为 tar -zxvf xx.tar.gz
.tar.bz2 格式解压为 tar -jxvf xx.tar.bz2
解压ISCE命令: tar -jxvf isce-2.0.0.bz2
添加源以及安装步骤如下:
sudo apt-get install python-software-properties #没有这步,下一步会提示add-apt-repository未找到.
sudo add-apt-repository ppa:fkrull/deadsnakes #添加ppa源
sudo apt-get update;
sudo apt-get install python3.4
//curl -O https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py
//sudo python3.4 get-pip.py
//使用软链接,ubuntu14.04系统已做完该工作;
//sudo ln -s /usr/bin/python3.4 /usr/bin/python3
上面三行代码过时
//获得get-pip.py文件;
curl -O https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
验证pip版本,命令行输入:pip -V
* 输出:pip 9.0.1 from /usr/local/lib/python3.4/dist-packages (python 3.4)*
确实是python3.4的.
sudo pip3 install h5py
安装目录: /usr/lib/python3/dist-packages
sudo apt-get install gcc g++ make m4
sudo apt-get install libmotif-dev #解决找不到xm/xm.h问题
sudo apt-get install libxt-dev #解决 X11/XXXX.h: No such file or directory
###6.1、快速安装
注: /home/lu/ISCE/ISCE_Application为安装目录,与解压的源码文件夹并列
执行命令:
./install.sh -p /home/lu/ISCE/ISCE_Application
该命令为一键式安装,首先会下载download、解压unpack、编译、安装install依赖包:GMP,MPFR,MPC,GCC,SCONS,FFTW,SZIP,HDF5,NUMPY,H5PY
注:若安装第三方依赖库中间过程出错,可通过-d、-u、-i参数安装指定包,已下载安装的包无需重复下载安装。
若手头已安装包,无需再次下载,则执行下面的命令:
./install.sh -p /home/lu/ISCE/ISCE_Application -d NONE -u GMP,MPFR,MPC,GCC,SCONS,FFTW,SZIP,HDF5,NUMPY,H5PY -i GMP,MPFR,MPC,GCC,SCONS,FFTW,SZIP,HDF5,NUMPY,H5PY
注:编译gcc大约花费1小时10分钟
编译NUMPY时报错,提示缺少python.h文件 ,采用新立得安装python-dev
重新执行安装(此时不下载、不解压、只编译安装NUMPY、H5PY)
./install.sh -p /home/lu/ISCE/ISCE_Application -d NONE -u NONE -i NUMPY,H5PY
亦可通过pip来安装h5py:
sudo pip install h5py
sudo pip3 install h5py
此时依赖库已经安装完成
只安装ISCE:
./install.sh -p /home/lu/ISCE/ISCE_Application -i NONE
在 /home/lu/.isce路经下生成SConfigISCE、.isceenv文件
PRJ_SCONS_BUILD=/home/lu/ISCE/ISCE_Application/build/isce_build
PRJ_SCONS_INSTALL=/home/lu/ISCE/ISCE_Application/isce
LIBPATH=/home/lu/ISCE/ISCE_Application/lib64 /home/lu/ISCE/ISCE_Application/lib /home/lu/ISCE/ISCE_Application/lib32 /usr/lib/x86_64-linux-gnu/ /usr/local/lib /usr/local/opengl
CPPPATH=/home/lu/ISCE/ISCE_Application/include/python3.4m
FORTRAN=/home/lu/ISCE/ISCE_Application/bin/gfortran
CC=/home/lu/ISCE/ISCE_Application/bin/gcc
CXX=/home/lu/ISCE/ISCE_Application/bin/g++
FORTRANPATH=/home/lu/ISCE/ISCE_Application/include
lxml:
sudo apt-get install libxml2-dev libxslt-dev python-dev
sudo pip3 install lxml -i https://pypi.tuna.tsinghua.edu.cn/simple
sudo pip install h5py
sudo apt-get install libmotif-dev #解决找不到xm/xm.h问题
sudo apt-get install libxt-dev #解决fatal error: X11/XXXX.h: No such file or directory
sudo ./install.sh -p /home/lu/ISCE/ISCE_Application -c /home/lu/.isce/SConfigISCE
设置环境变量Setup the Environment
source /home/lu/.isce/.isceenv
Test the installation and environment
//> python3
//>>> import isce
//>>> isce.version.release_version
测试失败:
在执行insarApp.py时,提示错误:
from . import multiarray ImportError: /home/lu/ISCE2.0/ISCE2.0_Application/lib/python/numpy/core/multiarray.so: undefined symbol: _Py_ZeroStruct
原因:安装NUMPY时采用了python而不是python3。
相似错误原因参考论坛:http://earthdef.caltech.edu/boards/4/topics/544
解决方法:采用python3重新编译安装NUMPY。
修改了setup.py 301,304行:
在python后添加了数字3
#execute: setup.py configure with flags
commands = [("setup", "python3 " + os.path.join(self.this_src, "setup.py configure " + self.flags), False)]
#previous command gives an error if configure is not needed, the script will then skip "configure"
#execute setup.py install
commands.append(("setup", "python3 " + os.path.join(self.this_src, "setup.py install " + self.flags), True))
重新执行了:
./install.sh -p /home/lu/ISCE2.0/ISCE2.0_Application -d NONE -u NONE -i NUMPY
等价于:
setup.py –ping=pong –uname=Linux –gcc=/usr/bin/gcc –gpp=/usr/bin/g++ –prefix=/home/lu/ISCE2.0/ISCE2.0_Application –download=NONE –unpack=NONE –install=NUMPY
python3 /home/lu/ISCE2.0/ISCE2.0_Application/src/numpy-1.8.1/setup.py configure –home=/home/lu/ISCE2.0/ISCE2.0_Application
python3 /home/lu/ISCE2.0/ISCE2.0_Application/src/numpy-1.8.1/setup.py install –home=/home/lu/ISCE2.0/ISCE2.0_Application
注意:记得在NUMPY文件夹下添加文件site.cfg
文件内容:
[DEFAULT]
library_dirs = /usr/local/lib:/usr/local/bin/atlas/lib
include_dirs = /usr/local/include:/usr/local/bin/include
[blas_opt]
libraries = f77blas, cblas, atlas
[lapack_opt]
libraries = lapack, f77blas, cblas, atlas
[amd]
amd_libs = amd
[umfpack]
umfpack_libs = umfpack