2013-05-18 7 views
5

私はちょうど私のMacBook Pro(10.7.5)にbrewでpython(2.7.4)をインストールしました。 また、exiv2とpyexiv2をbrewでインストールしました。 私はPythonインタプリタからpyexiv2をインポートすると、私は次のエラーを得た:pyexiv2 with homebrew python 2.7.4

致命的なPythonのエラー:インタプリタが初期化されていません(?バージョンの不一致)

私はそれを修正するために何をすべきか(私は望んでいないことを考慮すると、このスレッドで提案されているように醸造されたPythonを削除するには: How to install python library Pyexiv2 and Gexiv2 on osx 10.6.8?

ありがとうございました!

答えて

4

ウェブ上でいくつかの複雑なソリューションをたくさん検索して調べたところ、Homebrew wiki itselfのこの問題を解決する簡単な方法が見つかりました。

問題の根本は、wikiからシステムのpythonではなく醸造のpythonへのデフォルトのリンクによってboost依存ライブラリ、次のとおりです。

Note that e.g. the boost bottle is built against system python and should be brewed from source to make it work with a brewed Python. This can even happen when both python executables are the same version (e.g. 2.7.2). The explanation is that Python packages with C-extensions (those that have .so files) are compiled against a certain python binary/library that may have been built with a different arch (e.g. Apple's python is still not a pure 64bit). Other things can go wrong, too. Welcome to the dirty underworld of C.

(強調鉱山)

  1. まず、依存ライブラリとpyexiv2をアンインストールします。

    brew rm $(brew deps pyexiv2) 
    brew rm pyexiv2 
    
  2. 次に示さhereようなソースからboostをインストール:

    brew install boost --build-from-source 
    

    注:ビルドブーストは時間がかかる場合がありますので、我慢して、それは27.9分、私のシステムを取りました!

    usr/local/Cellar/boost/1.54.0: 9865 files, 568M, built in 27.9 minutes 
    
  3. が続いpyexiv2と依存関係を再インストールします(以下の出力):、それだけです

    brew install pyexiv2 
    

は今pyexiv2をインポートすることは完璧に動作するはずです。

+1

ありがとうございます!それは完全に動作します。 – jean

+1

29.5分で醸造。魅力のように動作します。本当にありがとう! –

+0

@ user1781670喜んで助けてください! –

1

あなたが実行しているPython(which python)を確認し、-vオプションを付けてpythonオプションを実行して、モジュールを探している場所を確認してください。それらのすべてがあなたの期待に合っていることを確認してください。次にbrew doctorを実行し、何も文句を言わない場合はバグを報告してください。

0

上記のbool.devの答えを使用して、MacOS Sierraでhomebrewとpyexiv2をインストールするのに苦労しました。 Homebrewed pyexiv2はインポート時にSegmentation Fault 11を投げつけ続けました。

私は最終的にそれがインストールされましたし、次のコマンドを使用してbool.devの答えを変更することで、自家製のPythonでの作業:

brew install boost --build-from-source 
brew install boost-python 
brew install exiv2 
sudo pip install git+https://github.com/escaped/pyexiv2.git 

私はGoogleにダウン吸い込ま取得した後、30ページのfollowing documentで最後の行を見つけました穴。

希望すると便利です。