pip安装PyQt IOError

31 投票
6 回答
16389 浏览
提问于 2025-04-16 14:54

我正在尝试用pip安装PyQt这个包,但出现了这个错误:

~$ pip install PyQt

Downloading/unpacking PyQt  
Downloading PyQt-x11-gpl-4.8.3.tar.gz
(9.8Mb): 9.8Mb downloaded   Running
setup.py egg_info for package PyQt
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
    IOError: [Errno 2] No such file or directory:
'/home/john/build/PyQt/setup.py'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 14, in
<module>

IOError: [Errno 2] No such file or
directory:
'/home/john/build/PyQt/setup.py

---------------------------------------- Command python setup.py egg_info
failed with error code 1 Storing
complete log in
/home/john/.pip/pip.log

6 个回答

5

你可以选择通过 ActivePython 的二进制包管理工具来安装 PyQt4。

$ pypm install pyqt4
The following packages will be installed into "~/.local" (2.7):
 pyqt4-4.8.3.0
Hit: [pypm-free.activestate.com] pyqt4 4.8.3.0
Installing pyqt4-4.8.3.0
$

只要你已经有了 PyPM,就不需要编译了。

9

如果你在使用Mac电脑,可以使用homebrew这个工具:

brew install pyqt
15

这是因为那个文件里有一个 configure.py,而不是 setup.py。这个 configure.py 文件会生成一个“make文件”,你可以用它来根据你选择的qt库来构建pyqt。你需要通过给 configure.py 传递一个叫做 --qmake 的选项来指定这个库,它还有其他不同的选项。我建议你可以向pip的维护者反馈这个问题。

撰写回答