安装pyqt5时出错(pip install pyqt5)

问题描述 投票:0回答:5

我已经在另一台电脑上安装了一次pyqt5。

我正在尝试在我的笔记本上安装 pyqt5。

我的笔记本电脑规格是: 64 位 AMD 锐龙 7 5800H MS Windows 10 专业版

我尝试过:

> pip install pyqt5
在命令上 并出现错误:

  Using cached PyQt5-5.15.6.tar.gz (3.2 MB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [140 lines of output]
      Collecting sip<7,>=6.4
        Using cached sip-6.6.1.tar.gz (1.1 MB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Collecting PyQt-builder<2,>=1.9
        Using cached PyQt_builder-1.12.2-py3-none-any.whl (5.6 MB)
      Collecting ply
        Using cached ply-3.11-py2.py3-none-any.whl (49 kB)
      Collecting toml
        Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
      Collecting packaging
        Using cached packaging-21.3-py3-none-any.whl (40 kB)
      Collecting setuptools
        Using cached setuptools-62.3.2-py3-none-any.whl (1.2 MB)
      Collecting pyparsing!=3.0.5,>=2.0.2
        Using cached pyparsing-3.0.9-py3-none-any.whl (98 kB)
      Building wheels for collected packages: sip
        Building wheel for sip (pyproject.toml): started
        Building wheel for sip (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error

        Building wheel for sip (pyproject.toml) did not run successfully.
        exit code: 1

        [105 lines of output]
        running bdist_wheel
        running build
        running build_py
        creating build
        creating build\lib.mingw_x86_64_clang-cpython-39
        creating build\lib.mingw_x86_64_clang-cpython-39\sipbuild
        copying sipbuild\abstract_builder.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild
        copying sipbuild\abstract_project.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild
        copying sipbuild\api.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild
        copying sipbuild\argument_parser.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild
        copying sipbuild\bindings.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild
        copying sipbuild\bindings_configuration.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild
        copying sipbuild\buildable.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild
        copying sipbuild\builder.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild
        copying sipbuild\configurable.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild
        copying sipbuild\distutils_builder.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild
        copying sipbuild\exceptions.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild
        copying sipbuild\installable.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild
        copying sipbuild\project.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild
        copying sipbuild\pyproject.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild
        copying sipbuild\py_versions.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild
        copying sipbuild\setuptools_builder.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild
        copying sipbuild\version.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild
        copying sipbuild\__init__.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild
        creating build\lib.mingw_x86_64_clang-cpython-39\sipbuild\distinfo
        copying sipbuild\distinfo\distinfo.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\distinfo
        copying sipbuild\distinfo\main.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\distinfo
        copying sipbuild\distinfo\__init__.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\distinfo
        creating build\lib.mingw_x86_64_clang-cpython-39\sipbuild\generator
        copying sipbuild\generator\python_slots.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\generator
        copying sipbuild\generator\specification.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\generator
        copying sipbuild\generator\templates.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\generator
        copying sipbuild\generator\utils.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\generator
        copying sipbuild\generator\__init__.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\generator
        creating build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module
        copying sipbuild\module\abi_version.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module
        copying sipbuild\module\main.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module
        copying sipbuild\module\module.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module
        copying sipbuild\module\__init__.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module
        creating build\lib.mingw_x86_64_clang-cpython-39\sipbuild\tools
        copying sipbuild\tools\build.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\tools
        copying sipbuild\tools\install.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\tools
        copying sipbuild\tools\sdist.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\tools
        copying sipbuild\tools\wheel.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\tools
        copying sipbuild\tools\__init__.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\tools
        creating build\lib.mingw_x86_64_clang-cpython-39\sipbuild\generator\parser
        copying sipbuild\generator\parser\annotations.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\generator\parser
        copying sipbuild\generator\parser\instantiations.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\generator\parser
        copying sipbuild\generator\parser\parser.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\generator\parser
        copying sipbuild\generator\parser\parser_manager.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\generator\parser
        copying sipbuild\generator\parser\parsetab.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\generator\parser
        copying sipbuild\generator\parser\python_exceptions.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\generator\parser
        copying sipbuild\generator\parser\rules.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\generator\parser
        copying sipbuild\generator\parser\tokens.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\generator\parser
        copying sipbuild\generator\parser\__init__.py -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\generator\parser
        creating build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source
        creating build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\apiversions.c -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\array.c -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\array.h -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\bool.cpp -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\descriptors.c -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\int_convertors.c -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\LICENSE -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\LICENSE-GPL2 -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\LICENSE-GPL3 -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\MANIFEST.in -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\objmap.c -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\pyproject.toml -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\qtlib.c -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\README.in -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\setup.cfg.in -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\setup.py.in -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\sip.h.in -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\sip.pyi -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\sip.rst.in -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\sipint.h -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\siplib.c -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\threads.c -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        copying sipbuild\module\source\12\voidptr.c -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\12
        creating build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\array.c -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\array.h -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\bool.cpp -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\descriptors.c -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\int_convertors.c -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\LICENSE -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\LICENSE-GPL2 -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\LICENSE-GPL3 -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\MANIFEST.in -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\objmap.c -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\pyproject.toml -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\README.in -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\setup.cfg.in -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\setup.py.in -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\sip.h.in -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\sip.pyi -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\sip.rst.in -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\sipint.h -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\siplib.c -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\threads.c -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        copying sipbuild\module\source\13\voidptr.c -> build\lib.mingw_x86_64_clang-cpython-39\sipbuild\module\source\13
        running build_ext
        building 'sipbuild.code_generator' extension
        error: --plat-name must be one of ('win32', 'win-amd64', 'win-arm32', 'win-arm64')
        [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for sip
      Failed to build sip
      ERROR: Could not build wheels for sip, which is required to install pyproject.toml-based projects
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

我搜索了这个错误并尝试了几种解决方案:

> pip install --user --upgrade pip
> pip install pyqt5
> pip3 install pyqt5 
> python3 -m pip install PyQt5
> python -m pip install --upgrade pip
> python -m pip install pyqt5

另外,我看到文章说我的python版本是3.10或更高可能会出现问题,所以我尝试将python版本重新安装到3.9。

上述解决方案似乎没有解决问题

python pip pyqt pyqt5
5个回答
0
投票

我能够通过安装最新的Python版本3.10.5来解决问题,单独更新pip没有帮助。在此之前我使用的是Python 3.8.9。


0
投票

您可能在计算机上的其他位置安装了不是最新版本的 python,并且您的系统环境变量指向了该版本。确保其他程序或库中没有安装 Python。例如,我在 MSYS2 中安装了 python,一旦我从计算机上卸载它,它就会安装。


0
投票

对我来说,安装 PyQt5 5.12.2 版本解决了问题。

pip install PyQt5==5.12.2
Pip install PyQtWebEngine==5.12

0
投票

我遇到了同样的问题,尝试了 slack 和其他来源上可用的所有内容,但再次发现相同的错误,人们建议更新 python 版本,有时 python 版本是运行任何应用程序的限制。这需要解决。然后我们才能继续其他安装。

我尝试过 conda 而不是 pip 或 pip3(pip 和 pip3 无法解决问题,即使在升级后也是如此),这在我的系统上有效。

conda install PyQt5

0
投票

我最近遇到了这个问题,对我来说“Python 3.7”的一个修复是先安装 pyqt5 sip,然后再安装 pyqt5。

也许对其他人有用。

pip install "PyQt5-sip==12.7.0"
pip install "PyQt5==5.13.1"
© www.soinside.com 2019 - 2024. All rights reserved.