Ubuntu,如何处理错误“<stdin>:1:10: fatal error: git2.h: No such file or directory”?

问题描述

我正在尝试在 miniconda 上的 R 3.6.1 上安装 easypackages R 包,这需要安装 gert 包,但失败了。这是日志:

* installing *source* package ‘gert’ ...
** package ‘gert’ successfully unpacked and MD5 sums checked
** using staged installation
Found pkg-config cflags and libs!
Using PKG_CFLAGS=
Using PKG_LIBS=-lgit2
----------------------------- ANTICONF -------------------------------
Configuration Failed to find libgit2 library. Try installing:
 * brew: libgit2 (MacOS)
 * deb: libgit2-dev (Debian,Ubuntu,etc)
 * rpm: libgit2-devel (Fedora,CentOS,RHEL)
If libgit2 is already installed,check that 'pkg-config' is in your
PATH and PKG_CONfig_PATH contains a libgit2.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
-------------------------- [ERROR MESSAGE] ---------------------------
<stdin>:1:10: Fatal error: git2.h: No such file or directory
compilation terminated.
----------------------------------------------------------------------
ERROR: configuration Failed for package ‘gert’
* removing ‘/home/dave/miniconda3/envs/r-environment/lib/R/library/gert’
ERROR: dependency ‘gert’ is not available for package ‘usethis’
* removing ‘/home/dave/miniconda3/envs/r-environment/lib/R/library/usethis’
ERROR: dependency ‘usethis’ is not available for package ‘devtools’
* removing ‘/home/dave/miniconda3/envs/r-environment/lib/R/library/devtools’
ERROR: dependency ‘devtools’ is not available for package ‘easypackages’
* removing ‘/home/dave/miniconda3/envs/r-environment/lib/R/library/easypackages’

The downloaded source packages are in
    ‘/tmp/RtmpsVDMkh/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning messages:
1: In install.packages(new.packages,repos = "http://cran.us.r-project.org") :
  installation of package ‘gert’ had non-zero exit status
2: In install.packages(new.packages,repos = "http://cran.us.r-project.org") :
  installation of package ‘usethis’ had non-zero exit status
3: In install.packages(new.packages,repos = "http://cran.us.r-project.org") :
  installation of package ‘devtools’ had non-zero exit status
4: In install.packages(new.packages,repos = "http://cran.us.r-project.org") :
  installation of package ‘easypackages’ had non-zero exit status
Error in library("easypackages") : 
  there is no package called ‘easypackages’
Execution halted

我已经安装了 libgit2-dev Ubuntu 软件包,但它没有解决问题。 关于如何修复它的任何建议? 我使用的是 Ubuntu 16.04.7 LTS 操作系统。

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)