9

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 ディレクトリに設定しました。それは正しい場所ですか?

4

4 に答える 4

4

をインストールlibgit2したことはありませんが、以下が役立つ場合があります。

ディストリビューションのリポジトリに libgit2 が含まれている場合は、以前にコンパイルしたものを削除し、リポジトリから libgit2 (バイナリ) および libgit2-dev (ヘッダーなど) パッケージをインストールすることをお勧めします。これにより、バイナリとソースが適切なディレクトリに配置されます。

git2.hそれ以外の場合は、へのシンボリックリンクを試してください/usr/local/include

于 2012-06-26T23:33:21.170 に答える
2

追加のインクルード ディレクティブが使用する(これがデフォルトです)ため、LIBGIT2変数がとったようには見えません(変数の設定方法を示していただけますか?)。/usr/local/include

env varはLIBGIT2、ライブラリがインストールされた場所のプレフィックスに設定する必要があります。通常は、/usrまたは/usr/local. /usr/localコンパイラがライブラリを見つけられないため、ライブラリがインストールされたようには見えませexport LIBGIT2=/usrsetup.py

于 2012-06-27T21:27:30.310 に答える