【问题标题】:check library version netcdf linux检查库版本 netcdf linux
【发布时间】:2015-11-14 01:38:11
【问题描述】:

如何确定我的系统中安装了哪个版本的 netcdf 库?有命令行吗?我尝试搜索“netcdf”并找到一堆文件,但无法确定版本号。 是否有命令检查已安装任何内容的版本?

我在ubuntu上

【问题讨论】:

    标签: linux ubuntu netcdf


    【解决方案1】:

    netCDF 为此提供了nc-config 命令行工具。

    打印版本。

    nc-config --version
    

    要打印有关您拥有的 netCDF 构建的更多信息:

    nc-config --all
    

    【讨论】:

      【解决方案2】:

      你可以用几行 C:

      #include <netcdf.h>
      #include <stdio.h>
      
      int main(void)
      {
          printf("I am NetCDF version %s\n", nc_inq_libvers());
      }
      

      在我的笔记本电脑上报告:

      I am NetCDF version 4.1.3 of Feb 24 2014 21:05:37 $
      

      【讨论】:

        【解决方案3】:

        我添加了两个比dpkg-query 更与操作系统无关的解决方案(在 Mac OS X 等上不起作用)。首先,版本信息通常包含在安装包的路径中,所以你可以使用which来显示它:

        $ which ncdump
        /usr/local/netcdf-4.2_optimized/bin/ncdump
        

        其次,许多文档字符串还包含版本号,因此只需将它们打印出来就可以了。例如,通过不带参数调用 ncdump 来打印使用说明:

        $ ncdump
        ncdump [-c|-h] [-v ...] [[-b|-f] [c|f]] [-l len] [-n name] [-p n[,n]] [-k] [-x] [-s] [-t|-i] [-g ...] [-w] file
               [-c]             Coordinate variable data and header information
               ...
               file             Name of netCDF file
        netcdf library version 4.2 of May 23 2012 12:14:03 $
        

        【讨论】:

          【解决方案4】:

          假设包已经安装,可以使用如下命令:

          dpkg-query --list netcdf
          

          我个人没有安装 netcdf,但是你会有这样的输出:

          $ dpkg-query --list netbase
          Desired=Unknown/Install/Remove/Purge/Hold
          | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
          |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
          ||/ Name           Version      Architecture Description
          +++-==============-============-============-=================================
          ii  netbase        5.3          all          Basic TCP/IP networking system
          

          【讨论】:

            猜你喜欢
            • 2021-10-26
            • 2017-05-12
            • 1970-01-01
            • 1970-01-01
            • 2019-01-31
            • 2018-05-17
            • 2021-10-20
            • 2016-02-10
            • 1970-01-01
            相关资源
            最近更新 更多