मुझे पता है कि मैंने बक्षीस बनाया है, लेकिन मुझे अधीरता मिली, जांच करने का फैसला किया, और अब मुझे कुछ ऐसा मिला है जो मेरे लिए काम करता है। मैं तुम्हारा काफ़ी मिलती-जुलती अजगर उदाहरण है, जो काफी अन्य कुछ नहीं से, Tkinter का उपयोग करें ताकि तरह एक छवि कमांड लाइन पर पारित कर दिया प्रदर्शित करने के लिए कोशिश करता है है:
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
को एक ढांचे से जोड़ा गया है, न कि एनवी में टीसीएल/टीसीसी libs।
(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)
इस के बाद, अपने कोड चलेंगे। किसी को शायद इस अपस्ट्रीम को पाने का प्रयास करना चाहिए।
परिशिष्ट: 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)
आप चाहें, तो आप बल्कि install_name_tool
बजाय @loader_path/../../
उपयोग करने के लिए उपयोग कर सकते हैं मैंने ऊपर जो प्रयोग किया, यानी @rpath/
। वह शायद भी काम करेगा, और यह भी बेहतर हो सकता है।
क्या आप एक ही कोड को 'आईडीईई' या टर्मिनल में चला सकते हैं? यदि यह एक 'एनाकोंडा' विशिष्ट प्रश्न है तो आपको सेटअप –
के बारे में अधिक विशिष्ट जानकारी देने की आवश्यकता हो सकती है बस यह सुनिश्चित करने के लिए, क्या आप मूल पीआईएल, या तकिया का उपयोग कर रहे हैं? –