参考资料: phonopy安装: 第一步:准备文件 第二步:安装Python-3.6.0b3.tar.xz Ø tar xvf Python-3.6.0b3.tar.xz Ø cd Python-3.6 Ø ./configure --prefix= /home/…/phonopy/Python-3.6/build (在python解压目录事先新建build目录,省略部分根据每个人电脑而定) Ø make Ø make install 设置环境变量 Ø vi ~/.bashrc 在.bashrc文件末尾加入: Ø export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/…/phonopy/Python-3.6/build/lib export PATH=$PATH:/home/…/phonopy/Python-3.6/build/bin export PATH=/home/…/phonopy/Python-3.6:$PATH Ø source ~/.bashrc 测试 Ø 命令行输入python3.6,若成功会出现(避免和系统自带/usr/bin混淆) Python 3.6.0b3 (default, Nov 6 2016,02:12:05) [GCC 4.9.3] on linux Type "help", "copyright", "credits" or"license" for more information. >>> 第三步:安装numpy-1.11.2.tar.gz Ø tar xzvf numpy-1.11.2.tar.gz Ø cd numpy-1.11.2 Ø cp site.cfg.example site.cfg Ø vi site.cfg: Ø 修改文件中如下所示部分: # [mkl] # library_dirs = /opt/intel/mkl/10.0.1.014/lib/32/ # lapack_libs = mkl_lapack # mkl_libs = mkl, guide 注意:mkl前面的注释一定要去掉,此外,左端不能留空格。 Ø 修改后的如下(根据实际情况修改): [mkl] library_dirs = /opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64 include_dirs = /opt/intel/composer_xe_2013_sp1.2.144/mkl/include lapack_libs = mkl_lapack95_lp64 mkl_libs = mkl_def,mkl_intel_lp64,mkl_intel_thread,mkl_core,guide,iomp5 (最后一行逗号为英文输入法下面的) Ø python3.6 setup.py build --help-fcompiler 查看下可用的编译器,结果发现--fcompiler=intelem可用 Ø python3.6 setup.py build --fcompiler=intelem Ø python3.6 setup.py install --home=Python3.6解压目录/pymodule (pymodule是自己在python解压目录下新建的numpy安装目录) Ø vi ~/.bashrc添加下面内容: PYTHONPATH="${PYTHONPATH}:/home/…/phonopy/Python3.6/pymodule/lib /python" export PYTHONPATH export PATH=/home/…/phonopy/Python-3.6/pymodule/bin:$PATH export PYTHONPATH=/home/…/phonopy/Python-3.6/pymodule/lib/python Ø source ~/.bashrc 让python知道到哪里去找模块 Ø 测试python是否能够调用numpy: Ø cd .. (退出 numpy的目录) 这一步一定要做,不然会出错, ImportError: Error importing numpy. Ø 输入:python3.6 进入python界面 Ø import numpy 执行 numpy 看是否出错 第四步:安装lxml-3.6.4.tgz Ø tar xzvf lxml-3.6.4.tgz Ø cd lxml-3.6.4 Ø vi ~/.bashrc添加下面内容: PYTHONPATH="${PYTHONPATH}:/home/…/phonopy/Python3.6/lxml/lib /python" (lxml是自己在python解压目录下新建的lxml安装目录) Ø source ~/.bashrc Ø python3.6 setup.py install --home=Python3.6解压目录/lxml 第五步:安装matplotlib-1.5.0.tar.gz Ø tar xzvf matplotlib-1.5.0.tar.gz Ø cd matplotlib-1.5.0 Ø vi ~/.bashrc添加下面内容: PYTHONPATH="${PYTHONPATH}:/home/…/phonopy/Python3.6/matplotlib /lib/python" (matplotlib是自己在python解压目录下新建的matplotlib安装目录) Ø source ~/.bashrc Ø python3.6 setup.py install --home=Python3.6解压目录/ matplotlib 第六步:安装PyYAML-3.12.tar.gz Ø tar xzvf PyYAML-3.12.tar.gz Ø cd PyYAML-3.12 Ø vi ~/.bashrc添加下面内容: PYTHONPATH="${PYTHONPATH}:/home/…/phonopy/Python3.6/pyyaml/lib /python" (pyyaml是自己在python解压目录下新建的pyyaml安装目录) Ø source ~/.bashrc Ø python3.6 setup.py test Ø python3.6 setup.py install --home=Python3.6解压目录/pyyaml 第七步:安装phonopy-1.11.0.tar.gz Ø tar xzvf phonopy-1.11.0.tar.gz Ø cd phonopy-1.11.0 Ø python3.6 setup.py install Ø 把/home/…/phonopy/phonopy-1.11.0/build/scripts-3.6的phonopy拷贝到usr/bin 测试 Ø 在phonopy目录下命令行输入phonopy: 结果显示: _ __ | |__ ___ ___ ___ _ __ _ _ | '_ \| '_ \ / _ \| '_ \ / _ \ | '_\| | | | | |_) | | | | (_) | | | | (_) || |_)| |_| | | .__/|_| |_|\___/|_| |_|\___(_).__/ \__, | |_| |_| |___/ 1.11.0 Crystal structure file of POSCAR (default file name) could not be found. ___ _ __ _ __ ___ _ __ / _ \ '__| '__/ _ \| '__| | __/ | | | | (_) | | \___|_| |_| \___/|_|
|