简体   繁体   English

在 python 2.7 上安装 PySide2

[英]install PySide2 on python 2.7

Trying for days but can't install PySide2 on python 2.7.15 while got no problem on python 3.7.尝试了几天但无法在 python 2.7.15 上安装 PySide2 而在 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.在 Qt for python(这是模块 PySide2 的项目名称)网站上明确写明支持 python 2.7,所以应该没问题。

I succeeded installing PySide2 on python 3 using:我使用以下方法成功地在 python 3 上安装了 PySide2:

pip install PySide2

then i tried installing PySide2 on python 2 using:然后我尝试使用以下方法在 python 2 上安装 PySide2:

python -m  pip install PySide2

which yelled error:其中大喊错误:

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

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.这意味着 2.7 没有这样的模块,即使 at 是用 Qt 编写的用于支持 python 2.7 的 python 网站。

also tried installing using Pycharm directly and failed with the the same error.还尝试直接使用 Pycharm 进行安装,但由于相同的错误而失败。

there is no even a single tutorial showing fully how to install PySide2 on python 2.7.甚至没有一个教程完整展示如何在 python 2.7 上安装 PySide2。

The pip install approach pulls the wheels from the pypi page . pip install 方法从pypi 页面拉动轮子。 If you look at the available wheels for cp27 (Python 2.7), there are only wheels for Linux and MacOS platform.如果您查看 cp27 (Python 2.7) 的可用轮子,则只有 Linux 和 MacOS 平台的轮子。 I'm assuming you are using a Windows Platform, which returns the error message as you have shown.我假设您使用的是 Windows 平台,它会返回如您所示的错误消息。

If there is no support on the pypi platform, your only way is to build PySide2 from the source on your platform.如果 pypi 平台不支持,您唯一的方法是从您平台上的源代码构建 PySide2。 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 解释器。

Note: Python 2.7 interpreter is not supported.注意:不支持 Python 2.7 解释器。 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.官网提供的官方 Python 2.7 二进制包使用 MSVC 2007 构建,而 Qt 库使用 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,请使用 MSVC 2015 或更高版本自行构建解释器,并使用它构建 Qt for Python。

The bolded statement is your answer.粗体声明是您的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM