2016-11-11 88 views
0

我需要使用QT和pyside進行學校項目,所以希望在我的電腦上安裝pyside。使用pyside導入錯誤

我掙扎了一下,安裝了pyside,我最終在python 2.7和3.4上使用pip安裝了pyside 1.2.4。

然而,當我試圖用pyside-UIC或進口PySide.QtCore我得到這個錯誤信息:

Traceback (most recent call last): 
File "<stdin>", line 1, in <module> 
ImportError: dlopen(/Library/Python/2.7/site-packages/PySide/QtCore.so, 2): Library not loaded: @rpath/libpyside-python2.7.1.2.dylib 
    Referenced from: /Library/Python/2.7/site-packages/PySide/QtCore.so 
    Reason: image not found 

我一直在這幾個小時,試圖與macport重新安裝。 我也試圖從QtCore.framework其他目錄使用鏈接:

ln -vis /usr/local/Cellar/qt/4.8.7_2/lib/QtCore.Framework /Library/Python/2.7/site-packages/PySide/QtCore.Framwork 

沒有制定出來,我仍然得到同樣的錯誤。 請大家幫忙,謝謝你們。

+0

我會建議使用自制而是看http://pyside.readthedocs.io/en/latest/installing/macosx.html - 確保你最終使用Python的正確版本太多(你將在這之後安裝Python的多個副本) –

回答

0

您是否嘗試設置DYLD_LIBRARY_PATH

export DYLD_LIBRARY_PATH=/Users/you/virtualenv/lib/python2.7/site-packages/PySide

在這裏看到:https://github.com/PySide/PySide/issues/129

+1

我認爲這是爲了在python虛擬環境中安裝pyside,我試過它沒有工作。無論如何感謝 –

+0

對不起,我忍不住更多,我希望你解決了你的問題。 – Khaled