我对 Linux 和 Python 还很陌生,我正在尝试安装 Python 软件(开放式电机) 在 python 虚拟环境中按照作者的建议进行操作,但在尝试安装所需的包时出现此错误消息。
$ pip install -r requirements.txt
Collecting appdirs
Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting cycler
Using cached cycler-0.11.0-py3-none-any.whl (6.4 kB)
Collecting decorator
Using cached decorator-5.1.1-py3-none-any.whl (9.1 kB)
Processing /home/daniel/.cache/pip/wheels/56/ea/58/ead137b087d9e326852a851351d1debf4ada529b6ac0ec4e8c/docopt-0.6.2-py2.py3-none-any.whl
Collecting ezdxf
Using cached ezdxf-1.0.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (3.2 MB)
Collecting imageio
Using cached imageio-2.26.1-py3-none-any.whl (3.4 MB)
Collecting matplotlib
Using cached matplotlib-3.7.1-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (9.2 MB)
Collecting networkx
Using cached networkx-3.0-py3-none-any.whl (2.0 MB)
Collecting numpy
Using cached numpy-1.24.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB)
Collecting Pillow
Using cached Pillow-9.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.3 MB)
Collecting pyparsing
Using cached pyparsing-3.0.9-py3-none-any.whl (98 kB)
Collecting pyqt-distutils
Using cached pyqt_distutils-0.7.3-py2.py3-none-any.whl (7.8 kB)
Collecting PyQt5
Using cached PyQt5-5.15.9.tar.gz (3.2 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: /home/daniel/openMotor/.venv/bin/python3 /tmp/tmpnkx3pbua prepare_metadata_for_build_wheel /tmp/tmpbc53w75u
cwd: /tmp/pip-install-n21cyx0e/PyQt5
Complete output (31 lines):
Traceback (most recent call last):
File "/tmp/tmpnkx3pbua", line 126, in prepare_metadata_for_build_wheel
hook = backend.prepare_metadata_for_build_wheel
AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/tmpnkx3pbua", line 280, in <module>
main()
File "/tmp/tmpnkx3pbua", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/tmp/tmpnkx3pbua", line 130, in prepare_metadata_for_build_wheel
return _get_wheel_metadata_from_wheel(backend, metadata_directory,
File "/tmp/tmpnkx3pbua", line 159, in _get_wheel_metadata_from_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "/tmp/pip-build-env-zzcpxk69/overlay/lib/python3.8/site-packages/sipbuild/api.py", line 46, in build_wheel
project = AbstractProject.bootstrap('wheel',
File "/tmp/pip-build-env-zzcpxk69/overlay/lib/python3.8/site-packages/sipbuild/abstract_project.py", line 87, in bootstrap
project.setup(pyproject, tool, tool_description)
File "/tmp/pip-build-env-zzcpxk69/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 585, in setup
self.apply_user_defaults(tool)
File "/tmp/pip-install-n21cyx0e/PyQt5/project.py", line 68, in apply_user_defaults
super().apply_user_defaults(tool)
File "/tmp/pip-build-env-zzcpxk69/overlay/lib/python3.8/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
super().apply_user_defaults(tool)
File "/tmp/pip-build-env-zzcpxk69/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 236, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "/tmp/pip-build-env-zzcpxk69/overlay/lib/python3.8/site-packages/pyqtbuild/builder.py", line 69, in apply_user_defaults
raise PyProjectOptionException('qmake',
sipbuild.pyproject.PyProjectOptionException
----------------------------------------
ERROR: Command errored out with exit status 1: /home/daniel/openMotor/.venv/bin/python3 /tmp/tmpnkx3pbua prepare_metadata_for_build_wheel /tmp/tmpbc53w75u Check the logs for full command output.
该软件是在 Python 3.10 中开发的,但我的 venv 运行的是 3.8,我猜想因为它是我的主要 Python 安装,这可能是原因吗?如果不是,有什么解决方法吗?
谢谢
答案1
问题是该程序qmake
不在你的PATH
(提示:https://stackoverflow.com/a/72046110)。如果您的系统上没有该程序,您可以通过以下方式安装:
sudo apt-get install qt5-qmake
虚拟环境是个好主意,因为它隔离了你的Python该项目的依赖项。但pyqt
有 Python 生态系统之外的依赖项。