[英]error importing QtGui from Pyside
我剛剛下載並安裝了PySide,嘗試從PySide導入QtGui時遇到此錯誤
$ python -c "from PySide import QtGui"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.7/site-packages/PySide/QtGui.so, 2): Symbol not found: __ZN7QLayout11adoptLayoutEPS_
Referenced from: /Library/Python/2.7/site-packages/PySide/QtGui.so
Expected in: /Library/Frameworks/QtGui.framework/Versions/4/QtGui
in /Library/Python/2.7/site-packages/PySide/QtGui.so
任何幫助將不勝感激。
昨天剛剛從pip安裝了PySide。 從“ PySide import QtGui”中檢查“ python -c”,一切正常。
冷杉檢查“ /Library/Python/2.7/site-packages/PySide/”目錄中是否有QtGui.so,並產生一個。
一個月前嘗試從源代碼安裝PyQt時遇到了編譯問題:一切看起來都不錯,但是缺少某些模塊(包括QtGui)(不記得了,但是問題出在某些配置文件中)。
嘗試從/Library/Python/2.7/site-packages/PySide/QtCore.so文件中刪除__ZN7QLayout11adoptLayoutEPS_ 。
您的代碼是正確的: python -c“從PySide導入QtGui”, 但是問題出在您的操作系統上 ,請從官方網站上下載PySide: https ://pypi.python.org/packages/f1/32/63872fdc1d9e0de5aa0b05b9d1a17d868851c619cdc6998dd9d853556f1b/PySide .1.tar.gz#md5 = b551d6ff68685013b59e478571f775bf
如果使用的是Windows,請運行cmd並鍵入以下命令:
cd <type here the python path>
example: cd C:\Python27
並輸入:
python <here the path of the extracted and download pyside file>\setup.py install
example: python C:\users\someuser\pysyde_extractedfiles\setup.py install
如果您使用的是Mac OS X,請運行終端並輸入:
cd /<you_python_install_dir>
python /<your_extracted_pyside_files_path/setup.py install>
example: cd /opt/python27 && python /tmp/pyside_extracted/setup.py install
如果您使用的是Linux(Ubuntu,Debian,ArchLinux)
wget <here_the_pyside_download_url>
cd /home/<you_username>/<you_extracted_pyside_folder>
python setup.py install
如果您使用python3,請輸入:
python3 setup.py install
希望對您有所幫助!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.