1.安装包intel_fortran_xe_2013_for_linux解压
去intel官网下载:https://software.intel.com/en-us/fortran-compilers/choose-download
学生是免费的,需要注册
2.执行安装脚本:./install.sh
3.根据需要“Enter”或“acccept”或者选择适合的选项,粘贴许可证路径,安装路径等
4.开始安装。这里我遇到一个磁盘空间不足的问题,因为我只在虚拟机上装的Ubuntu,安装的时候只分配了20G的大小,所以进行到这里,我去给磁盘空间扩了个容(在网上找的教程),扩完容之后改了下安装路径,这下磁盘空间够了,就能安装啦。
5.设置环境变量。打开.bashrc:gedit ~/.bashrc
在后面加上:export PATH=安装路径/bin:$PATH
使环境变量生效:source .bashrc
6.测试:在编辑器上编辑一个文件hello.f90:
program hello
print *,"hello fortran!"
end program hello
编译这个文件:ifort -o hello hello.f90,出现一个可执行文件hello
执行hello:./hello
结果:hello fortran
至此,Fortran安装成功!