本文介绍了在Mac上安装PySide:有没有可行的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可能做错了什么,但是我一直在尝试在Mac 10.12(Sierra)上安装pyside.这是我尝试过的(使用brew安装Qt之后):

I may be doing something wrong, but I have been trying to install pyside on Mac 10.12 (Sierra). Here is what I tried (after installing Qt with brew):

  • 使用预编译的软件包(1.2.1);由于软件包不兼容"而失败.
  • 使用sudo -H pip install pyside(1.2.4):失败,并出现以下错误:
  • With the precompiled package (1.2.1); fails because of "incompatible package".
  • With sudo -H pip install pyside (1.2.4): fails with the following error:
 Qt QTGUI library not found.
 Qt QTXML library not found.
 Qt QTCORE library not found.
 CMake Error at ApiExtractor/CMakeLists.txt:82 (qt4_add_resources):
  Unknown CMake command "qt4_add_resources".

  • 使用brew install pyside==1.2.2:可以成功运行,但是从python程序调用时,失败,并显示ImportError: dlopen(/Library/Python/2.7/site-packages/PySide/QtCore.so, 2): Libmrary not loaded: libpyside-python2.7.1.2.dylibReferenced from: /Library/Python/2.7/site-packages/PySide/QtCore.soReason: unsafe use of relative rpath libpyside-python2.7.1.2.dylib in /Library/Python/2.7/site-packages/PySide/QtCore.so with restricted binary
    • With brew install pyside==1.2.2 : works successfully but when calling it from a python program, fails with ImportError: dlopen(/Library/Python/2.7/site-packages/PySide/QtCore.so, 2): Libmrary not loaded: libpyside-python2.7.1.2.dylibReferenced from: /Library/Python/2.7/site-packages/PySide/QtCore.soReason: unsafe use of relative rpath libpyside-python2.7.1.2.dylib in /Library/Python/2.7/site-packages/PySide/QtCore.so with restricted binary
    • 最后一个确实提供了一些希望,我尝试了.不幸的是,这种解释非常省略,我最终将事情进一步打破了.

      The last one did offer some hope, and I tried PySide import error Mac OS X El Capitan, Library not loaded: @rpath/libpyside.cpython-34m.1.2.dylib . Unfortunately, the explanation was quite elliptic and I ended up breaking things further.

      我缺少明显的东西吗?预编译的软件包较旧且Web文档未更新,brew安装似乎不起作用(文档未提及)的事实,并且通常会询问有关pyside和答案的技术复杂性的问题数量似乎不是很好的迹象.

      Am I missing something obvious? The fact that the precompiled packages are old and the web doc is not updated, that brew install does not seem to work (and the documentation makes no mention of it) and generally number of questions asked about pyside and the technical complication of the answers do not seem very good signs.

      有人从技术上知道PySide在Mac OS上的安装是怎么回事吗?在我的特定情况下,最好的解决方案是什么?

      Does someone know what the matter is with PySide's installation on Mac OS, technically? What's the best solution in my particular case?

      更一般地说,在Mac上使用PySide是否有改进的希望?

      More generally, is there hope for improvement with PySide on Mac?

      由于我们正在等待Pyside的更新,是否有人愿意接受使用brew在OS Sierra上安装1.2.2的挑战,并解决不安全使用相对路径"的问题?也许提出一个分步教程?

      Since we are waiting for an update from Pyside, is someone willing to take the challenge of installing 1.2.2 on OS Sierra with brew, and resolve the "unsafe use of relative path"? Perhaps propose a step-by-step tutorial?

      这可能为Mac上的PySide节省了一天……同时减轻了Pyside开发团队的时间压力?

      That might save the day for PySide on Mac... while relieving the time pressure on the Pyside development team?

      推荐答案

      我有MAC osSierra(10.12.6).我需要为Python 3.3.6安装PySide 1.2.4.我执行了以下操作来构建和安装所需的PySide 1.2.4.我猜您可以对任何Python 3.3.x执行以下操作.

      I have MAC osSierra (10.12.6). I needed to install PySide 1.2.4 for Python 3.3.6. I did the following to build and install PySide 1.2.4 that I need. You can do the following for any Python 3.3.x, I guess.

      我是Mac和Python的新手.如果我有任何错误,请忽略.

      I am a newbie to Mac and Python. Please ignore if I have any mistakes.

      • 安装pyenv
        简单安装pyenv
      • 使用pyenv安装Python 3.3.6
        pyenv安装3.3.6
      • 将python 3.3.6添加到系统路径中
        PATH ="/Users/myname/.pyenv/versions/3.3.6/bin:$ {PATH}"
        导出路径
      • 从应用商店中安装Xcode,然后运行以下命令. Xcode的下载和安装对我来说花费了30-40分钟.
        xcode-select --install
        sudo xcodebuild -license
      • 安装cmake
        酿造cmake
      • 验证cmake已安装.我看到已安装版本3.10.0
        cmake —版本
      • 点击qt4.注意:我尝试过qt5,但是pyside build不适用于qt5.
        自来水卡特/QT4
        酿造自来水车/qt4
      • 安装qt @ 4.
        简单安装qt @ 4
      • 确认已安装qmake.我看到安装了2.01a版
        qmake —版本
        (如果无法识别qmake,请使用以下命令创建指向其的链接)
        brew link cartr/qt4/qt @ 4 --force
      • 如果在程序中使用"PySide.QtWebKit",则需要安装qt-webkit.安装pyside(1.2.2 ??),它将安装qt-webkit.我不确定是否可以直接安装qt-webkit,如果有人可以纠正我的话.
        酿造pyside
      • 下载PySide 1.2.4 tar文件.
        wget https://pypi.python .org/packages/source/P/PySide/PySide-1.2.4.tar.gz
      • 解压缩tar文件
        tar -xvf PySide-1.2.4.tar.gz
      • 进入文件夹
        cd PySide-1.2.4
      • 构建pyside.对于我来说,此构建步骤花费了将近30-40分钟
        python setup.py bdist_wheel
      • 验证是否已创建"dist"文件夹,并且其中包含pyside wheel文件.
      • 进入"dist"文件夹
        cd dist
      • 安装PySide,最后一步!!
        pip安装PySide-1.2.4-cp33-cp33m-macosx_10_12_x86_64.whl
      • 恭喜!您现在拥有适用于Python 3.3.x的PySide 1.2.4
      • Install pyenv
        brew install pyenv
      • Install Python 3.3.6 using pyenv
        pyenv install 3.3.6
      • Add python 3.3.6 into system path
        PATH="/Users/myname/.pyenv/versions/3.3.6/bin:${PATH}"
        export PATH
      • Install Xcode from app store, then run the following. Xcode download and install took 30-40 minutes for me.
        xcode-select --install
        sudo xcodebuild -license
      • Install cmake
        brew install cmake
      • Verify cmake is installed. I see version 3.10.0 installed
        cmake —version
      • Tap qt4. Note: I tried qt5, but pyside build is not working for me with qt5.
        brew tap cartr/qt4
        brew tap-pin cart/qt4
      • Install qt@4.
        brew install qt@4
      • Verify qmake is installed. I see version 2.01a installed
        qmake —version
        (If qmake is not recognized, create links to it using below command)
        brew link cartr/qt4/qt@4 —-force
      • If you are using "PySide.QtWebKit" in your programs, you need to install qt-webkit. Install pyside (1.2.2 ??), which will install qt-webkit. I am not sure if qt-webkit can be installed directly, if so someone can correct me.
        brew install pyside
      • Download PySide 1.2.4 tar file.
        wget https://pypi.python.org/packages/source/P/PySide/PySide-1.2.4.tar.gz
      • Untar the tar file
        tar -xvf PySide-1.2.4.tar.gz
      • Go into the folder
        cd PySide-1.2.4
      • Build pyside. This build step took almost 30-40 minutes for me
        python setup.py bdist_wheel
      • Verify that "dist" folder is created and it has pyside wheel file in it.
      • Go into the "dist" folder
        cd dist
      • Instal PySide, last step!!
        pip install PySide-1.2.4-cp33-cp33m-macosx_10_12_x86_64.whl
      • Congratulations!, now you have PySide 1.2.4 for Python 3.3.x

      这篇关于在Mac上安装PySide:有没有可行的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 12:59