编程语言
首页 > 编程语言> > python – 为什么我错过了git2.h以及如何将其恢复?

python – 为什么我错过了git2.h以及如何将其恢复?

作者:互联网

每次尝试设置pygit2时,我都会遇到一个奇怪的问题.下面是我运行的和生成的错误.

$python3 setup.py install
running install
running build
running build_py
running build_ext
building '_pygit2' extension
/usr/bin/clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -I/usr/local/include -Iinclude -I/usr/local/Cellar/python3/3.2.3/include/python3.2m -c src/pygit2.c -o build/temp.macosx-10.7-x86_64-3.2/src/pygit2.o
In file included from src/pygit2.c:32:
include/pygit2/error.h:6:10: fatal error: 'git2.h' file not found
#include <git2.h>
         ^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1

我想我已经成功安装了libgit2(构建并使make完成).也许这是一个路径问题?我已将LIBGIT2环境变量设置为libgit2文件夹中的src目录.那是对的地方吗?

解决方法:

我从未安装过libgit2,但以下内容可能有所帮助:

如果您的发行版的存储库包含libgit2,我建议删除之前编译的内容,并从repo安装libgit2(二进制文件)和libgit2-dev(头文件等)软件包.这会将二进制文件和源代码放到正确的目录中.

否则,尝试将git2.h符号链接到/usr/local/include

标签:c-3,python,git,linker,libgit2
来源: https://codeday.me/bug/20190902/1787809.html