我尝试使用 pip 安装 pytq5 并收到此错误
\n$ python3 -m pip install PyQt5\nCollecting PyQt5\n Using cached PyQt5-5.15.6.tar.gz (3.2 MB)\n Installing build dependencies ... done\n Getting requirements to build wheel ... done\n Preparing metadata (pyproject.toml) ... error\n error: subprocess-exited-with-error\n \n \xc3\x97 Preparing metadata (pyproject.toml) did not run successfully.\n \xe2\x94\x82 exit code: 1\n \xe2\x95\xb0\xe2\x94\x80> [29 lines of output]\n Traceback (most recent call last):\n File "/Users/olivierskonieczny/Desktop/app/python/ObjectDetection/envs/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 156, in prepare_metadata_for_build_wheel\n hook = backend.prepare_metadata_for_build_wheel\n AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'\n \n During handling of the above exception, another exception occurred:\n \n Traceback (most recent call last):\n File "/Users/olivierskonieczny/Desktop/app/python/ObjectDetection/envs/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>\n main()\n ...\n ...\n ...\n [end of output]\n \n note: This error originates from a subprocess, and is likely not a problem with pip.\nerror: metadata-generation-failed\n\n\xc3\x97 Encountered error while generating package metadata.\n\xe2\x95\xb0\xe2\x94\x80> See above for output.\n\nnote: This is an issue with the package mentioned above, not pip.\nhint: See above for details.\nRun Code Online (Sandbox Code Playgroud)\n我仍然可以安装其他软件包,例如 lxml,但无法安装 pytq5。我正在虚拟环境中安装所有内容。
\n有任何想法吗 ??
\nPre*_*ter 31
您需要在系统中安装 Qt5,并且需要将其安装qmake在PATH.
要安装 Qt5,您可以从https://www.qt.io/download-qt-installer运行brew install qt5或下载安装程序。
请注意,如果您选择使用安装程序,它将要求您登录或创建 qt.io 帐户来执行安装。
如果您有旧版本的 MacOS,可以从https://download.qt.io/archive/qt/下载旧版本的安装程序。您可以在https://doc.qt.io/archives/qt-5.14/supported-platforms.html中检查哪个版本支持您的操作系统版本,您可以在其中将 url 中的 qt-5.14 替换为您感兴趣的版本。
安装完成后,找到qmake所在位置。对于我使用 5.14.2 的安装程序来说,它位于/Users/Admin/Qt5.14.2/5.14.2/clang_64/bin. 您需要将其添加到PATH环境变量中。为此,请.bash_profile在您的主文件夹中进行编辑(可能需要先按Command + Shift + .才能在 Finder 中查看点文件)并向其中添加以下内容:
export PATH="$PATH:/Users/Admin/Qt5.14.2/5.14.2/clang_64/bin"
Run Code Online (Sandbox Code Playgroud)
现在,启动新终端后,您应该能够键入qmake并看到输出的帮助文本。现在安装 PyQt5 应该会成功(前提是您安装的 Qt5 版本支持您的 MacOS 版本)。
小智 8
这些天我遇到了同样的问题。当您查看PyPi 下载站点时,您可以在安装章节中读到您需要“路径上的 Qt 的 qmake 工具”。安装 Qt 的开发文件后,一切对我来说都工作正常。因此,首先安装它并确保它在您的路径中,然后重试。
sudo apt-get install qtbase5-dev
pip install pyqt5
Run Code Online (Sandbox Code Playgroud)
PS:我认为这与你的python或pip版本无关。我尝试了很多版本,每次都遇到这个问题。它只是丢失、损坏或找不到 qt5 的头开发文件。
问候, 瓦利
好吧,我在使用 python 时遇到了这个问题3.10.4,经过搜索,我找到了这个问题的两个解决方案,因为这个问题不仅存在于海龟中,也存在于其他库中。
#Note:如果您遇到上述问题并且我在 Windows 中遇到了这个问题,这些解决方案可用于下载任何库。
所以你可以尝试这样的方式:
pip install turtle==0.0.1
Run Code Online (Sandbox Code Playgroud)
0.0.1这是该库的最后一个版本,因此您应该找到要为此目的安装的库的版本,您可以使用以下命令找到该库的版本:
pip show module <name_of_the_library>
Run Code Online (Sandbox Code Playgroud)
另一个可行的解决方案是使用--use-deprecated=backtrack-on-build-failures
例子:
pip install turtle --use-deprecated=backtrack-on-build-failures
Run Code Online (Sandbox Code Playgroud)
希望对您有所帮助。
小智 3
就像@Ken1124一样,我在尝试下载工具(又名 pyqt5-tools)时解决了同样的问题。经过多次尝试,我发现将 python 从 3.10.x 降级到版本 3.9.x(特别是 3.9.9)很有帮助。如果你当前有 python 3.10 它可能会有所帮助,但否则我不知道......
我尝试过的其他方法没有看到可以解决该问题,但也许也解决了与该问题相关的其他问题:
我知道的就这些了,祝你好运:)
| 归档时间: |
|
| 查看次数: |
209981 次 |
| 最近记录: |