pip安装更新PySide出现错误

14
有人知道如何避免在运行pip install -U PySide时出现以下错误吗?这是根据官方网站的说明进行操作的:https://pypi.python.org/pypi/PySide/#installing-pyside-on-a-mac-os-x-system 请注意,我已经成功地执行了brew install qt
You are using pip version 7.0.3, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting PySide
  Using cached PySide-1.2.4.tar.gz
Installing collected packages: PySide
  Running setup.py install for PySide
    Complete output from command /Applications/anaconda/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-build-CPxEmt/PySide/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-0r7hrI-record/install-record.txt --single-version-externally-managed --compile:
    Removing /private/var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-build-CPxEmt/PySide/pyside_package
    running install
    running build
    Python architecture is 64bit
    Inserting path "/private/var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-build-CPxEmt/PySide/pyside_install/py2.7-qt4.8.6-64bit-release/bin" to environment
    ==============================
    Package version: 1.2.4
    Build type: Release
    Build tests: False
    ---
    Make path: /usr/bin/make
    Make generator: Unix Makefiles
    Make jobs:
    ---
    Script directory: /private/var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-build-CPxEmt/PySide
    Sources directory: /private/var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-build-CPxEmt/PySide/sources
    Build directory: /private/var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-build-CPxEmt/PySide/pyside_build/py2.7-qt4.8.6-64bit-release
    Install directory: /private/var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-build-CPxEmt/PySide/pyside_install/py2.7-qt4.8.6-64bit-release
    Python site-packages install directory: /private/var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-build-CPxEmt/PySide/pyside_install/py2.7-qt4.8.6-64bit-release/lib/python2.7/site-packages
    ---
    Python executable: /Applications/anaconda/bin/python
    Python includes: /Applications/anaconda/include/python2.7
    Python library: /Applications/anaconda/lib/libpython2.7.dylib
    Python prefix: /Applications/anaconda
    Python scripts: /Applications/anaconda/bin
    ---
    Qt qmake: /Applications/anaconda/bin/qmake
    Qt version: 4.8.6
    Qt bins: /Applications/anaconda/bin
    Qt plugins: /Applications/anaconda/plugins
    ---
    OpenSSL libs: None
    ==============================
    Creating build folder /private/var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-build-CPxEmt/PySide/pyside_build/py2.7-qt4.8.6-64bit-release...
    Creating install folder /private/var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-build-CPxEmt/PySide/pyside_install/py2.7-qt4.8.6-64bit-release...
    Building module shiboken...
    Creating module build folder /private/var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-build-CPxEmt/PySide/pyside_build/py2.7-qt4.8.6-64bit-release/shiboken...
    Configuring module shiboken (/private/var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-build-CPxEmt/PySide/sources/shiboken)...
    Running process: /usr/local/bin/cmake -G "Unix Makefiles" -DQT_QMAKE_EXECUTABLE=/Applications/anaconda/bin/qmake -DBUILD_TESTS=False -DDISABLE_DOCSTRINGS=True -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/private/var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-build-CPxEmt/PySide/pyside_install/py2.7-qt4.8.6-64bit-release /private/var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-build-CPxEmt/PySide/sources/shiboken -DPYTHON_EXECUTABLE=/Applications/anaconda/bin/python -DPYTHON_INCLUDE_DIR=/Applications/anaconda/include/python2.7 -DPYTHON_LIBRARY=/Applications/anaconda/lib/libpython2.7.dylib -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=yes -DALTERNATIVE_QT_INCLUDE_DIR=/Applications/anaconda/include
    /usr/local/bin/cmake -G Unix Makefiles -DQT_QMAKE_EXECUTABLE=/Applications/anaconda/bin/qmake -DBUILD_TESTS=False -DDISABLE_DOCSTRINGS=True -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/private/var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-build-CPxEmt/PySide/pyside_install/py2.7-qt4.8.6-64bit-release /private/var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-build-CPxEmt/PySide/sources/shiboken -DPYTHON_EXECUTABLE=/Applications/anaconda/bin/python -DPYTHON_INCLUDE_DIR=/Applications/anaconda/include/python2.7 -DPYTHON_LIBRARY=/Applications/anaconda/lib/libpython2.7.dylib -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=yes -DALTERNATIVE_QT_INCLUDE_DIR=/Applications/anaconda/include
    -- The C compiler identification is AppleClang 7.0.0.7000072
    -- The CXX compiler identification is AppleClang 7.0.0.7000072
    CMake Error at /usr/local/Cellar/cmake/3.3.0/share/cmake/Modules/Platform/Darwin.cmake:76 (message):
      CMAKE_OSX_DEPLOYMENT_TARGET is '10.5' but CMAKE_OSX_SYSROOT:

       ""

      is not set to a MacOSX SDK with a recognized version.  Either set
      CMAKE_OSX_SYSROOT to a valid SDK or set CMAKE_OSX_DEPLOYMENT_TARGET to
      empty.
    Call Stack (most recent call first):
      /usr/local/Cellar/cmake/3.3.0/share/cmake/Modules/CMakeSystemSpecificInformation.cmake:36 (include)
      CMakeLists.txt:2 (project)


    -- Configuring incomplete, errors occurred!
    See also "/private/var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-build-CPxEmt/PySide/pyside_build/py2.7-qt4.8.6-64bit-release/shiboken/CMakeFiles/CMakeOutput.log".
    error: Error configuring shiboken

    ----------------------------------------
Command "/Applications/anaconda/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-build-CPxEmt/PySide/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-0r7hrI-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/dy/ttgqhqqx3g9bsbsnqnxsk2z80000gq/T/pip-build-CPxEmt/PySide

更新 (2016年3月16日):

最近我得到了一个完整更新的Mac OS X 10.11(El Capitan)。我成功地执行了brew install qt,然后尝试了pip install -U PySide(按照这些说明:https://pypi.python.org/pypi/PySide/#installing-pyside-on-a-mac-os-x-system)。不幸的是,我再次收到了一个错误信息:

Collecting PySide
  Downloading PySide-1.2.4.tar.gz (9.3MB)
    100% |████████████████████████████████| 9.3MB 162kB/s 
Installing collected packages: PySide
  Running setup.py install for PySide ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/km/x8ww58k15h74q73fvrbqxym40000gp/T/pip-build-ozZWDt/PySide/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/km/x8ww58k15h74q73fvrbqxym40000gp/T/pip-YVPqB6-record/install-record.txt --single-version-externally-managed --compile:
    Removing /private/var/folders/km/x8ww58k15h74q73fvrbqxym40000gp/T/pip-build-ozZWDt/PySide/pyside_package
    running install
    running build
    Python architecture is 64bit
    error: Failed to find cmake. Please specify the path to cmake with --cmake parameter.

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/km/x8ww58k15h74q73fvrbqxym40000gp/T/pip-build-ozZWDt/PySide/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/km/x8ww58k15h74q73fvrbqxym40000gp/T/pip-YVPqB6-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/km/x8ww58k15h74q73fvrbqxym40000gp/T/pip-build-ozZWDt/PySide/

自从我最初发布这篇文章以来已经过了很多个月,根据点赞数来判断,我不是唯一一个遇到这个问题的人。因此,我开始怀疑可能是 https://pypi.python.org/pypi/PySide/#installing-pyside-on-a-mac-os-x-system 的说明已经过时了。如果有人真正能够让它工作,请上传步骤。谢谢。

1
PySide 1.2.4版本的MacOS X二进制文件尚未发布。您可以按照此处的说明构建二进制文件http://pyside.readthedocs.org/en/latest/building/macosx.html,或者使用先前版本1.2.2的官方二进制文件,使用“pip install pyside==1.2.2”。 - rlacko
仍然是同样的错误。我已经为这个问题苦苦挣扎了两个月了。 - warship
3
有任何更新吗?我在El Capitan上遇到了相同的错误。 - user1387717
我其实还在等待这个问题的回复。我非常惊讶它仍然没有得到答案。我建议你发一个类似的问题,并将它链接给我(如果可能的话)。 - warship
@user1387717 上面发布了El Capitan更新... - warship
5个回答

3

我尝试了各种方法都无法通过pip安装,最终我改用homebrew:

$ brew install pyside

它能很好地运行!

我使用的是Mac OS X 10.11(El Capitan)。


没问题,这对我也有效,我只是想提醒一下它不能按照网站上的指示使用pip安装。 - warship
5
看起来它已经被迁移到Homebrew墓地了,可以通过brew install homebrew/boneyard/pyside安装。 :'( - mfink

3

首先,这是我第一次在stackoverflow上回答问题,请耐心等待我的回答。

我安装了cmake以安装pyside,遇到了与你相同的问题。然后,我尝试使用homebrew:

$ brew doctor

显示cmake已安装但未链接。为了链接它,我需要用homebrew运行:

$ brew link cmake

之后,我再次尝试:

$ pip3.4 install -U PySide

它起作用了,现在已安装并正在运行。希望这有所帮助。


花了将近一年的时间才弄明白,但等待是值得的。欢迎来到 Stack Overflow!希望能经常见到你。 - warship

1

截至2018年6月,在MacOS High Sierra上,您仍会遇到此问题。

  • 确保安装了qt 4.8.7,“brew install qt”默认安装不兼容PySide的qt5,如果已安装qt5,请卸载并安装qt4。

    brew tap cartr/qt4

    brew install qt@4

  • 如果未检测到qmake,请在bashrc中为qmake创建别名 alias qmake="/usr/local/Cellar/qt@4/4.8.7_5/bin/qmake"

  • pip install pyside现在应该可以工作了,花费大约30分钟才能完成。所以,请耐心等待。


0

要在您的系统上安装二进制Python模块,您需要正确配置您的OS X机器以使用构建工具。这意味着使用最新的OS X版本和已安装命令行工具的最新XCode。

我看到部署目标10.5,这让我感到害怕,因为当前的OS X版本是10.11...听起来像是一个过时的SDK。


0

我通过将CMake添加到我的路径中来解决了第二个问题:

$> PATH="/Applications/CMake.app/Contents/bin":"$PATH"

这样CMake就可以被找到了。但我仍然被第一个问题难倒了,事实上,在处理CMake后,我遇到了第一个问题。

以下是我的设置:

  • Mac OS X(10.10.5)
  • Python 2.7.10
  • pip 8.0.2
  • Qt 4.8.6
  • CMake 3.6.0-rc02
  • Xcode命令行工具已安装。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接