:D 获取中...

1 1 normal version python

1.1 1.1 python reinstall

yum search openssl
yum install openssl-devel.x86_64  -y
cd  /home/ywmu/backup/compiled.soft/Python/Python-2.7.10
./configure   --enable-shared --prefix=/opt/Python27
##注意 :不加 --enable-shared 参数将编译静态的python,无法使用PyInstall的打包。
make
make install

export PATH=/opt/Python27/bin:$PATH
export LD_LIBRARY_PATH=/opt/Python27/lib:/opt/intel/Compiler/mkl/lib/em64t:$LD_LIBRARY_PATH

1.2 1.2 pip and setup tools

wget https://pypi.python.org/packages/source/s/setuptools/setuptools-17.0.tar.gz --no-check-certificate
tar xf setuptools-17.0.tar.gz
cd setuptools-17.0
python setup.py build
python setup.py install

curl -O  https://pypi.python.org/packages/source/p/pip/pip-7.1.2.tar.gz -k
tar xvfz pip-7.1.2.tar.gz
cd pip-7.1.2
python setup.py install

# or:
curl -o get-pip.py https://github.com/pypa/get-pip/blob/master/get-pip.py
python get-pip.py

1.3 1.3 numpy and scipy (ifort and MKL needed)

curl -O  https://pypi.python.org/packages/source/n/numpy/numpy-1.10.0.tar.gz -k
curl -O  https://pypi.python.org/packages/source/s/scipy/scipy-0.16.0.tar.gz -k
tar -xvf numpy-1.10.0.tar.gz
cd numpy-1.10.0
cp site.cfg.example site.cfg
## Modify site.cfg:
 [mkl]
 library_dirs = /opt/intel/mkl/10.0.1.014/lib/32/
 lapack_libs = mkl_lapack
 mkl_libs = mkl, guide

 to 
[mkl]
library_dirs = /opt/intel/mkl/lib/intel64:/opt/intel/lib/intel64
include_dirs =  /opt/intel/mkl/include/intel64/lp64
mkl_libs = mkl_def, mkl_intel_lp64, mkl_intel_thread, mkl_core, iomp5
lapack_libs = mkl_lapack95_lp64
 
python setup.py build --fcompiler=intelem
python setup.py install --record install.file.list
or: python setup.py config --compiler=intelem build_clib --compiler=intelem build_ext --compiler=intelem install

tar -xvf scipy-0.16.0.tar.gz
cd scipy-0.16.0
cp ../numpy-1.10.0/site.cfg
python setup.py build --fcompiler=intelem
python setup.py install --record install.file.list

1.4 1.4 libxslt and lxml

# download libxslt-1.1.28.zip and libxml2-2.7.2.tar.gz from  ftp://xmlsoft.org/libxml2/
tar -xvf libxml2-2.7.2.tar.gz
cd libxml2-2.7.2
./configure --prefix=/opt/sharelib --without-crypto --without-python --with-libxml-prefix=/opt/sharelib
make && make install

unzip libxslt-1.1.28.zip
cd libxslt-1.1.28
# (maybe need yum install  libtool.x86_64 and yum install autoconf)
./autogen
./configure --prefix=/opt/sharelib --without-crypto --without-python --with-libxml-prefix=/opt/sharelib
make && make install

wget  http://pypi.python.org/packages/source/l/lxml/lxml-3.0.1.tar.gz
tar -xvf lxml-3.0.1.tar.gz
cd  lxml-3.0.1
python setup.py  build --with-xslt-config=/opt/sharelib/bin/xslt-config
python  setup.py install
export  LD_LIBRARY_PATH=/opt/sharelib/lib:$LD_LIBRARY_PATH

1.5 1.5 matplotlib, yaml and PyInstaller(may be needed)

pip install matplotlib
pip install pyyaml
 or: pip install -i --trusted-host http://pypi.douban.com/simple  pyyaml 
 or: curl -O http://pyyaml.org/download/pyyaml/PyYAML-3.11.tar.gz -k && pip install PyYAML-3.11.tar.gz   (tested) 
pip install PyInstaller
 or: download from https://github.com/pyinstaller/pyinstaller/releases/download/3.0/PyInstaller-3.0.tar.gz && pip install /PyInstaller-3.0.tar.gz (tested)

1.6 1.6 phonopy

 download from http://sourceforge.net/projects/phonopy/files/phonopy/
tar -xvf phonopy-1.9.6.3.tar.gz
cd  phonopy-1.9.6.3
python setup.py install   (install to python  directory, no $PYTHONPATH needed)

ps: the first line of python files:

#!/opt/Python27/bin/python needed to changed to #!/usr/bin/env python.

maybe needed:

mkdir  phonopy.onefile && cd phonopy.onefile
for cmd in $(ls ../phonopy-1.9.6.3/bin/) ; do   pyinstaller --onefile  /opt/Python27/bin/$cmd ; done

1.7 1.7 phono3py

## modify setup.py, add two lines in lapacke part:
## /opt/openblas.gnu/lib/libopenblas.so copied to 
## /home/.soft/mybin/lib/libopenblas.so.0 before
include_dirs += ['/opt/openblas.gnu/include']
extra_link_args_lapacke = ['/opt/openblas.gnu/lib/libopenblas.so']

export CC=gcc FC=gfortran
python setup.py install 

2 2 install conda python:

  • basic
wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p /home/ywmu/.soft/miniconda
  • add to env_mini.sh
export PATH=/home/ywmu/.soft/miniconda/bin:${PATH}
export C_INCLUDE_PATH=/home/ywmu/.soft/include:${C_INCLUDE_PATH}
export LD_LIBRARY_PATH=/home/ywmu/.soft/miniconda/lib:${LD_LIBRARY_PATH}
. env_mini.sh
  • update and add channel
#conda update --yes conda
conda config --add channels conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
  • add python 2.7
conda create -n py2 python=2.7
source activate py2
conda install --yes python=2.7 numpy
 deactivate
  • install lib, phonopy and phono3py
source deactivate py2
export TRAVIS_PYTHON_VERSION=3.5  #3.5 needed by phono3py
conda install --yes python=$TRAVIS_PYTHON_VERSION pip numpy h5py pyyaml matplotlib openblas
conda install -c atztogo --yes python=$TRAVIS_PYTHON_VERSION phonopy
conda install -c atztogo --yes python=$TRAVIS_PYTHON_VERSION phono3py