【问题标题】:error importing QtGui from Pyside从 Pyside 导入 QtGui 时出错
【发布时间】:2018-03-03 11:22:07
【问题描述】:

我刚刚下载并安装了 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

任何帮助将不胜感激。

【问题讨论】:

    标签: python pyside


    【解决方案1】:

    昨天刚刚从 pip 安装了 PySide。 检查“python -c”from PySide import QtGui”一切正常。

    首先检查“/Library/Python/2.7/site-packages/PySide/”目录中是否有QtGui.so,因为有。

    一个月前尝试从源代码安装 PyQt 时遇到了编译问题:一切看起来都很好,但缺少一些模块(包括 QtGui)(不记得了,但问题出在某个配置文件中)。

    【讨论】:

      【解决方案2】:

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

      你的代码是正确的: python -c "from PySide import QtGui" 问题出在你的系统上,从官网下载PySide:https://pypi.python.org/packages/f1/32/63872fdc1d9e0de5aa0b05b9d1a17d868851c619cdc6998dd9d853556f1b/PySide-1.2.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
      

      希望对您有所帮助!

      【讨论】:

        猜你喜欢
        • 2013-07-28
        • 1970-01-01
        • 2021-04-21
        • 2014-02-21
        • 1970-01-01
        • 2017-02-28
        • 1970-01-01
        • 2014-05-01
        • 2018-01-15
        相关资源
        最近更新 更多