欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ubuntu20.04安装gfortran-6/libgfortran.so.3

程序员文章站 2022-03-08 10:04:02
...

当我尝试在ubuntu20.04上运行GAMIT下的doy命令时,显示:

[email protected]:/etc/apt# doy
doy: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory

其中libgfortran.so.3依赖于gfortran-6,则尝试安装gfortran-6:

[email protected]:/etc/apt# apt install gfortran-6
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package gfortran-6

这里的问题是ubuntu20.04不支持g+±6,添加以下源至/etc/apt/sources.list,添加源方式见链接

deb http://gb.archive.ubuntu.com/ubuntu/ bionic main universe

运行

sudo apt-get update

安装gcc++ -6

apt-get install g++-6

设置gcc默认版本

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 6

安装gfortran-6

 apt install gfortran-6

安装成功,运行doy

[email protected]:/etc/apt# doy 2020 001
Date 2020/01/01  0:00 hrs, DOY   1 JD  2458849.5000 MJD  58849.0000
GPS Week  2086 Day of week  3, GPS Seconds 259200 Day of Week Wed
Decimal Year 2020.000000000 GRACE Seconds 631108800.0

运行成功