首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何处理错误"<stdin>:1:10: fatal error: git2.h:没有这样的文件或目录“?

如何处理错误"<stdin>:1:10: fatal error: git2.h:没有这样的文件或目录“?
EN

Stack Overflow用户
提问于 2021-01-08 23:17:12
回答 1查看 705关注 0票数 0

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

代码语言:javascript
复制
* 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操作系统。

EN

回答 1

Stack Overflow用户

发布于 2021-09-12 07:30:25

不是Ubuntu的答案,但可能会对其他调试有所帮助。在Mac 10.15.7 Catalina上的R 4.1.1中安装包'devtools‘时出现类似的错误。运行brew install libgit2解决了这个问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65631688

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档