在 python 2.7 上安装 PySide2 [英] install PySide2 on python 2.7

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

问题描述

尝试了几天但无法在 python 2.7.15 上安装 PySide2,而在 python 3.7 上没有问题.在 Qt for python(这是模块 PySide2 的项目名称)网站上明确写明支持 python 2.7,所以应该没问题.

Trying for days but can't install PySide2 on python 2.7.15 while got no problem on python 3.7. On Qt for python(which is the project name for the module PySide2) website at is written explicitly that python 2.7 is supported so that should be no problem.

我使用以下方法成功地在 python 3 上安装了 PySide2:

I succeeded installing PySide2 on python 3 using:

pip install PySide2

然后我尝试使用以下方法在 python 2 上安装 PySide2:

then i tried installing PySide2 on python 2 using:

python -m  pip install PySide2

哪个大喊错误:

ERROR: Could not find a version that satisfies the requirement PySide2(from versions: none)

这意味着 2.7 没有这样的模块,即使 at 是用 Qt 编写的支持 python 2.7 的 python 网站.

which means there is no such module for 2.7 even though at is written in Qt for python website that python 2.7 is suported.

也尝试直接使用 Pycharm 安装,但以同样的错误失败.

also tried installing using Pycharm directly and failed with the the same error.

甚至没有一个教程完整展示如何在 python 2.7 上安装 PySide2.

there is no even a single tutorial showing fully how to install PySide2 on python 2.7.

推荐答案

pip install 方法从 pypi 页面.如果您查看 cp27 (Python 2.7) 的可用轮子,则只有 Linux 和 MacOS 平台的轮子.我假设您使用的是 Windows 平台,它会返回如您所示的错误消息.

The pip install approach pulls the wheels from the pypi page. If you look at the available wheels for cp27 (Python 2.7), there are only wheels for Linux and MacOS platform. I'm assuming you are using a Windows Platform, which returns the error message as you have shown.

如果pypi平台不支持,你唯一的方法就是在你的平台上从源代码构建PySide2.此文档 展示了如何从源代码构建.但是,根据此文档,它不支持 Python 2.7 解释器.

If there is no support on the pypi platform, your only way is to build PySide2 from the source on your platform. This document shows how to build from source. However, according to this very document, it does not support Python 2.7 interpreter.

注意:不支持 Python 2.7 解释器.官网提供的官方 Python 2.7 二进制包使用 MSVC 2007 构建,而 Qt 库使用 MSVC 2015/2017 构建.如果您打算使用 Python 2.7,请使用 MSVC 2015 或更高版本自行构建解释器,并使用它构建 Qt for Python.

Note: Python 2.7 interpreter is not supported. The official Python 2.7 binary package offerred on the official website is built using MSVC 2007, while the Qt libraries are built using MSVC 2015/2017. If you intend to use Python 2.7, build the interpreter yourself with MSVC 2015 or later, and build Qt for Python with it.

粗体声明是您的答案.

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

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