在 Ubuntu 20 上安装 ifort

问题描述

我正在尝试在 Ubuntu20 上安装 ifort 编译器。我从以下站点下载了安装文件intel

enter image description here

这是一个扩展名为 .sh 的文件,我将其设为可执行文件

  Downloads$ chmod +x l_fortran-compiler_p_2021.1.2.62_offline.sh
  Downloads$ ./l_fortran-compiler_p_2021.1.2.62_offline.sh

这打开了软件安装程序:

enter image description here

enter image description here

但是,我不能使用 ifort 编译器。示例:

  ifort -o name name.for

它给出了以下消息:

  Command 'ifort' not found,did you mean:

    command 'fort' from deb fort-validator (1.2.0-1)
    command 'isort' from deb isort (4.3.4+ds1-2)

  Try: sudo apt install <deb name>

我需要安装 intel ifort 编译器,因为如果我使用 -fast 选项编译可执行文件会更快。

解决方法

documentation 说明如何设置环境:

For root or sudo installations:

. /opt/intel/oneapi/setvars.sh

For normal user installations:

. ~/intel/oneapi/setvars.sh

您可以将这些放入您的 bash 配置文件或 bashrc。