为 Python3 安装 PySide [英] Installing PySide for Python3

查看:52
本文介绍了为 Python3 安装 PySide的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试为 Python-3.6 安装 PySide 时,它​​说它只兼容 Python-3.4.是否有任何解决方法可以为 Python-3.6 安装它?

When I try to install PySide for Python-3.6, it says it is only compatible until Python-3.4. Is there any work-around to get it installed for Python-3.6?

似乎只支持这些 Python 版本:

Only these Python versions seem to be supported:

[(2, 6), (2, 7), (3, 2), (3, 3), (3, 4)].

推荐答案

要获得最新的 PySide,请安装 PyPI 的官方二进制轮子之一,其中包含捆绑的 Qt,因此是完全可移植的.

To get the latest PySide, install one of the official binary wheels from PyPI which includes a bundled Qt and is therefore fully portable.

  • 对于 Qt5 - [Python 2.7/Python >= 3.5]:

  • For Qt5 - [Python 2.7 / Python >= 3.5]:

  pip install pyside2

  • 对于 Qt6 - [Python >= 3.6]:

  • For Qt6 - [Python >= 3.6]:

      pip install pyside6
    

  • 以下部分中提供的信息与 PySide-1.2/Qt4 相关,除非您需要支持旧系统,否则不再相关.

    The information presented in the section below relates to PySide-1.2/Qt4 and is no longer relevant unless you need to support legacy systems.

    首先需要指出的是,PySide 依赖于 Qt4,Qt4 不再被官方支持(截至 2015 年 12 月).因此,现在所有的开发工作都集中在 PySide2 和 Qt5 上.根据这个跟踪器问题正式没有计划> 支持 Python-3.4 以外的 PySide - 主要是由于资源不足和在 Windows 上编译困难.当前位置(截至 2017 年 2 月),似乎由 这篇文章总结:

    Firstly, it should be pointed out that PySide depends on Qt4, which is no longer officially supported (as of December 2015). In consequence, all development efforts are now focused on PySide2 and Qt5. According to this tracker issue, there are no plans for officially supporting PySide beyond Python-3.4 - mainly due to lack of resources and the difficulty of compiling on Windows. The current position (as of February 2017), seems to be summed up by this post:

    最后剩下的基本上是一个不会修复的问题,因为需要修改两者使用用于 Python 的编译器进行编译的 Qt 4.8 和 PySide 源3.5 在 Windows 上.此外,不再支持 Qt 4.8,并且不应将 PySide 用于新项目.PySide2,下一个版本,是Python 和 Qt 的未来,并支持 Python 3.5.你可以了解一下在 Qt Wiki 上.

    This was last left as basically a wontfix, as one needs to modify both Qt 4.8 and PySide sources to compile with the compiler used for Python 3.5 on Windows. Furthermore, Qt 4.8 is no longer supported, and PySide should not be used for new projects. PySide2, the next version, is the future of Python and Qt, and supports Python 3.5. You can find out more about it on the Qt Wiki.

    话虽如此,目前有几个 Linux 发行版维护 Python-3.5 和/或 Python-3.6 的 PySide 包.这通常只需要生成绑定的 shiboken 工具的一个小补丁(参见 Arch Linux PKGBUILD,例如).此外,Christoph Gohlke 的非官方 Windows 二进制文件网站.(恐怕我不太了解 Mac 的情况,但我确实找到了 Python-3.5 的这个轮子).

    Having said all that, there are several Linux distros that currently maintain PySide packages for Python-3.5 and/or Python-3.6. This usually only requires a small patch to the shiboken tool which generates the bindings (see the Arch Linux PKGBUILD, for example). In addition, there are Windows wheels available on Christoph Gohlke's Unofficial Windows Binaries site. (I'm afraid I don't know much about the situation for Mac, but I did find this wheel for Python-3.5).

    所以 PySide 本身目前仍然与 Python-3.5 & 兼容.3.6 - 但官方安装程序不是.但是,如果您愿意修补工具链或使用非官方二进制文件,这应该不是问题.实际上,PySide 和 Qt4 现在是冻结的代码库,因此除非对 Python 进行一些真正彻底的更改,否则它应该"在未来的几个版本中仍然可行.不过,未来是PySide2.

    So PySide itself is still currently compatible with Python-3.5 & 3.6 - but the official installers aren't. However, if you're willing to patch the toolchain or use unofficial binaries, this shouldn't be a problem. Effectively, PySide and Qt4 are now frozen codebases, so unless there are some really radical changes made to Python, it "should" remain viable for several releases to come. The future is PySide2, though.

    这篇关于为 Python3 安装 PySide的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆