美文网首页
Linux安装R包ggalt遇见的proj4报错

Linux安装R包ggalt遇见的proj4报错

作者: 心惊梦醒 | 来源:发表于2022-12-08 18:02 被阅读0次

    遇到报错不要着急用字眼百度答案,报错中给的提示是最重要的。

      在百度中折腾好几个小时,还因为用conda安装proj4,把本来好好的环境变量变得面目全非,source ~/.bahrc也不管用。最后认认真真看了报错,发现只需要设置好PKG_CONFIG_PATH就可以了。

    # 先设置PKG_CONFIG_PATH环境变量
    # 对应proj.pc所在路径
    export PKG_CONFIG_PATH=/home/lucky/anaconda3_202105/lib/pkgconfig/:$PKG_CONFIG_PATH
    
    # 然后重新运行安装命令 install.packages('proj4')
    # 再运行 install.packages('ggalt') 即可
    
    # 以下是安装proj4时候的报错
    > install.packages('proj4')
    trying URL 'https://mirrors.bfsu.edu.cn/CRAN/src/contrib/proj4_1.0-12.tar.gz'
    Content type 'application/octet-stream' length 42887 bytes (41 KB)
    ==================================================
    downloaded 41 KB
    
    * installing *source* package ‘proj4’ ...
    ** package ‘proj4’ successfully unpacked and MD5 sums checked
    ** using staged installation
    checking whether pkg-config knows about proj... no
    checking whether the C++ compiler works... yes
    checking for C++ compiler default output file name... a.out
    checking for suffix of executables... 
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether the compiler supports GNU C++... yes
    checking whether x86_64-conda-linux-gnu-c++ -std=gnu++14 accepts -g... yes
    checking for x86_64-conda-linux-gnu-c++ -std=gnu++14 option to enable C++11 features... none needed
    checking for stdio.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for strings.h... yes
    checking for sys/stat.h... yes
    checking for sys/types.h... yes
    checking for unistd.h... yes
    checking for proj_api.h... no
    checking with ACCEPT_USE_OF_DEPRECATED_PROJ_API_H... 
    checking for proj_api.h... no
    checking for proj.h... no
    checking for proj_get_source_crs in -lproj... no
    configure: Retrying with pkg-config --static
    Package proj was not found in the pkg-config search path.
    Perhaps you should add the directory containing `proj.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'proj' found
    checking for proj_get_source_crs in -lproj... no
    configure: PROJ4 API available: no
    configure: PROJ6 API available: no
    checking whether to require PROJ6 API... no
    configure: error: Cannot find working proj.h headers and library.
    *** You may need to install libproj-dev or similar! ***
    
    ERROR: configuration failed for package ‘proj4’
    * removing ‘/home/lucky/anaconda3_202105/envs/R4.1.1/lib/R/library/proj4’
    
    The downloaded source packages are in
        ‘/tmp/RtmpSVjnRX/downloaded_packages’
    Updating HTML index of packages in '.Library'
    Making 'packages.html' ... done
    Warning message:
    In install.packages("proj4") :
      installation of package ‘proj4’ had non-zero exit status
    

      还需要赶快恢复下原来的环境变量设置~~~

    相关文章

      网友评论

          本文标题:Linux安装R包ggalt遇见的proj4报错

          本文链接:https://www.haomeiwen.com/subject/xponfdtx.html