可以从setuptools setup.py中要求PyQt吗?

Mac*_*cke 16 python distutils pyqt setuptools

我正在构建一个使用PyQt的小应用程序,并且很高兴在setup.py中声明该依赖项.

然而,根据这个博客(谷歌首次点击pyqt setuptools)说它无法完成,而且这里的最后一段也没有尝试去做.

想法?也许我应该切换到PyPi上的PySide

更新:

显而易见的install_requires = [ 'pyqt >= 0.7' ]setup.py:

D:\3rd\BuildBotIcon\my-buildboticon\python>setup.py test
running test
install_dir .
Checking .pth file support in .
C:\Python26-32\pythonw.exe -E -c pass
Searching for pyqt>=4.7
Reading http://pypi.python.org/simple/pyqt/
Reading http://www.riverbankcomputing.com/software/pyqt/
Reading http://www.riverbankcomputing.com/software/pyqt/download
No local packages or download links found for pyqt>=4.7
error: Could not find suitable distribution for Requirement.parse('pyqt>=4.7')
Run Code Online (Sandbox Code Playgroud)

Len*_*bro 5

是的,PyQT软件包没有使用distutils/setup.py进行安装,因此无法使用easy_install或pip进行安装.您需要手动下载并安装它.

这也意味着,你应该把它放在你的requires元数据,easy_install的和PIP然后将尝试安装和失败.

我不知道PySide是否有用,但也没有setup.py,也拒绝使用easy_install/pip安装,所以不是一个好选择.:)

另一个选择是使用distutils重新打包PyQt,但这可能需要做很多工作.

  • @dotancohen:不,它仍然只是一个包含元数据的页面,没有可下载的页面. (2认同)

mfi*_*tzp 2

虽然接受的答案最初是正确的,但Python Wheels现在提供了一种安装 C 扩展包(例如 PyQt5)的方法,而无需从源代码进行编译。

\n\n

PyPi 目前拥有.whl适用于多个平台的 Python3 上的 PyQt5 的文件,包括MacOS X、Linux(任何)、Win32 和 Win64。例如,这是在 Mac 上的 Python3 上 pip 安装 PyQt5 时的输出:

\n\n
mfitzp@MacBook-Air ~ $ pip3 install pyqt5\nCollecting pyqt5\n  Downloading PyQt5-5.6-cp35-cp35m-macosx_10_6_intel.whl (73.2MB)\n    100% |\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88| 73.2MB 2.5kB/s \nCollecting sip (from pyqt5)\n  Downloading sip-4.18-cp35-cp35m-macosx_10_6_intel.whl (46kB)\n    100% |\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88| 49kB 1.8MB/s \nInstalling collected packages: sip, pyqt5\nSuccessfully installed pyqt5-5.6 sip-4.18\n
Run Code Online (Sandbox Code Playgroud)\n\n

如果您的目标是 Python3+PyQt5,那么将 PyQt5 指定为setup.py.

\n