简体   繁体   English

从Pyside导入QtGui时出错

[英]error importing QtGui from Pyside

I just downloaded and installed PySide and I am getting this error when I try to import 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

any help would be greatly appreciated. 任何帮助将不胜感激。

Just installed PySide from pip yesterday. 昨天刚刚从pip安装了PySide。 Checked "python -c "from PySide import QtGui" everything importing fine. 从“ PySide import QtGui”中检查“ python -c”,一切正常。

Firs check if you have QtGui.so in "/Library/Python/2.7/site-packages/PySide/" directory, cause a have. 冷杉检查“ /Library/Python/2.7/site-packages/PySide/”目录中是否有QtGui.so,并产生一个。

Some month ago trying to install PyQt from sources got problem with compilation: everything looks fine, but some modules (including QtGui) was absent (can't remember but problem was in some config file). 一个月前尝试从源代码安装PyQt时遇到了编译问题:一切看起来都不错,但是缺少某些模块(包括QtGui)(不记得了,但是问题出在某些配置文件中)。

Try remove the: __ZN7QLayout11adoptLayoutEPS_ from /Library/Python/2.7/site-packages/PySide/QtCore.so file. 尝试从/Library/Python/2.7/site-packages/PySide/QtCore.so文件中删除__ZN7QLayout11adoptLayoutEPS_

You code is correct: python -c "from PySide import QtGui" but the problem is on your os system , download PySide from official website: https://pypi.python.org/packages/f1/32/63872fdc1d9e0de5aa0b05b9d1a17d868851c619cdc6998dd9d853556f1b/PySide-1.2.1.tar.gz#md5=b551d6ff68685013b59e478571f775bf 您的代码是正确的: python -c“从PySide导入QtGui”, 但是问题出在您的操作系统上 ,请从官方网站上下载PySide: https ://pypi.python.org/packages/f1/32/63872fdc1d9e0de5aa0b05b9d1a17d868851c619cdc6998dd9d853556f1b/PySide .1.tar.gz#md5 = b551d6ff68685013b59e478571f775bf

If you are using Windows, run cmd and type this command: 如果使用的是Windows,请运行cmd并键入以下命令:

cd <type here the python path>
example: cd C:\Python27

and type: 并输入:

python <here the path of the extracted and download pyside file>\setup.py install
example: python C:\users\someuser\pysyde_extractedfiles\setup.py install

If you are usinc Mac OS X run the terminal and type: 如果您使用的是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

If you are using Linux (Ubuntu, Debian, ArchLinux) 如果您使用的是Linux(Ubuntu,Debian,ArchLinux)

wget <here_the_pyside_download_url>
cd /home/<you_username>/<you_extracted_pyside_folder>
python setup.py install

If you use python3 then type: 如果您使用python3,请输入:

python3 setup.py install

I hope this help you! 希望对您有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM