私は賞金を創出したことを知っていますが、私は気難しく、調査することに決めました。今は私のために働くものがあります。私はかなりので、同じように、コマンドラインに渡された画像を表示するためのTkinterを使用しようとする以外に何もしないされ、あなたに非常によく似たPythonの例があります。何が起こっている
calebhattingh $ python imageview.py a.jpg
objc[84696]: Class TKApplication is implemented in both /Users/calebhattingh/anaconda/envs/py35/lib/libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.
objc[84696]: Class TKMenu is implemented in both /Users/calebhattingh/anaconda/envs/py35/lib/libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.
objc[84696]: Class TKContentView is implemented in both /Users/calebhattingh/anaconda/envs/py35/lib/libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.
objc[84696]: Class TKWindow is implemented in both /Users/calebhattingh/anaconda/envs/py35/lib/libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.
Segmentation fault: 11
はバイナリファイルということです、~/anaconda/envs/py35/lib/python3.5/site-packages/PIL/_imagingtk.so
はフレームワークにリンクされており、envのTcl/Tkライブラリにはリンクされていません。
(py35) ~/anaconda/envs/py35/lib/python3.5/site-packages/PIL
calebhattingh $ otool -L _imagingtk.so
_imagingtk.so:
/System/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl (compatibility version 8.5.0, current version 8.5.9)
/System/Library/Frameworks/Tk.framework/Versions/8.5/Tk (compatibility version 8.5.0, current version 8.5.9)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
は、これら二つの「フレームワーク」の行を参照してください:あなたは、リンクの設定を参照してくださいotool
を使用してこれを見ることができますか?アナコンダでは、それを望んでいません。私たちはenvのライブラリを使いたいと思っています。だから彼らを変えよう!
まず(場合には、あなたが戻したい)バイナリのバックアップを行います。
$ cp _imagingtk.so _imagingtk.so.bak
は今(あなたがenvname/lib
と同じフォルダにあると仮定した場合)、コマンドラインでこれを実行します。
$ install_name_tool -change "/System/Library/Frameworks/Tk.framework/Versions/8.5/Tk" "@rpath/libtk8.5.dylib" _imagingtk.so
$ install_name_tool -change "/System/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl" "@rpath/libtcl8.5.dylib" _imagingtk.so
あなたはそこに@rpath
ビットが表示されますか?つまり、のパスにあるのいずれかが見つかります。アナコンダにはうってつけの作品です。 _imagingtk.so
ライブラリ内のリンクは次のようになります。この後
(py35) ~/anaconda/envs/py35/lib/python3.5/site-packages/PIL
calebhattingh $ otool -L _imagingtk.so
_imagingtk.so:
@rpath/libtcl8.5.dylib (compatibility version 8.5.0, current version 8.5.9)
@rpath/libtk8.5.dylib (compatibility version 8.5.0, current version 8.5.9)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
、あなたのコードが実行されます。誰かがおそらくこの上流を取得しようとする必要があります。
補遺:Pythonディストリビューションに結合Tkinterの、すなわち、現在アクティブなcondaのENVは、以下のリンクがあります
~/anaconda/envs/py35/lib/python3.5/lib-dynload
calebhattingh $ otool -L _tkinter.cpython-35m-darwin.so
_tkinter.cpython-35m-darwin.so:
@loader_path/../../libtcl8.5.dylib (compatibility version 8.5.0, current version 8.5.18)
@loader_path/../../libtk8.5.dylib (compatibility version 8.5.0, current version 8.5.18)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.0.0)
ご希望の場合は、むしろ代わりに@loader_path/../../
を使用するようにinstall_name_tool
を使用することができます私が上記で使用したもののうち、@rpath/
。それは、おそらくでも動作し、さらに良いかもしれません。
「IDLE」または「ターミナル」で同じコードを実行できますか?これが「anaconda」固有の質問であれば、設定に関するより具体的な情報を提供する必要があるかもしれません。 –
元のPILまたはPillowを使用していますか? –