如何在MacOS Catalina上安装Qt5

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

我正在尝试安装 Geant4 依赖项,其中之一是 Qt5。我使用 Homebrew 安装它。

brew install qt@5

等了2个小时,brew没有安装Qt5。

==> /usr/local/opt/[email protected]/libexec/bin/python -m pip install .
Last 15 lines from /Users/kaan/Library/Logs/Homebrew/python-packaging/03.python:
  File "/usr/local/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1304, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1318, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'flit_core'


[notice] A new release of pip is available: 23.2.1 -> 23.3.1
[notice] To update, run: python3.12 -m pip install --upgrade pip

Do not report this issue to Homebrew/brew or Homebrew/homebrew-core!


Error: You are using macOS 10.15.
We (and Apple) do not provide support for this old version.
It is expected behaviour that some formulae will fail to build in this old version.
It is expected behaviour that Homebrew will be buggy and slow.
Do not create any issues about this on Homebrew's GitHub repositories.
Do not create any issues even if you think this message is unrelated.
Any opened issues will be immediately closed without response.
Do not ask for help from Homebrew or its maintainers on social media.
You may ask for help in Homebrew's discussions but are unlikely to receive a response.
Try to figure out the problem yourself and submit a fix as a pull request.
We will review it but may or may not accept it.

我尝试了MacPorts进行安装:

sudo port install qt5

但是它也不起作用,我收到了这个错误:

Continue? [Y/n]: Y
--->  Fetching archive for qt5-qtsvg
--->  Attempting to fetch qt5-qtsvg-5.15.8_0.darwin_19.x86_64.tbz2 from https://packages.macports.org/qt5-qtsvg
--->  Attempting to fetch qt5-qtsvg-5.15.8_0.darwin_19.x86_64.tbz2 from https://fra.de.packages.macports.org/qt5-qtsvg
--->  Attempting to fetch qt5-qtsvg-5.15.8_0.darwin_19.x86_64.tbz2 from https://nue.de.packages.macports.org/qt5-qtsvg
--->  Configuring qt5-qtsvg
Error: Failed to configure qt5-qtsvg: configure failure: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_aqua_qt5/qt5-qtsvg/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there
is a bug.
Error: Processing of port qt5 failed
qt5 homebrew macos-catalina macports
1个回答
0
投票

要在 macOS Catalina 上安装 Qt5,您可以使用 Homebrew,这是一款流行的 macOS 包管理器。请按照以下步骤操作:

  1. 安装自制程序: 打开终端并运行以下命令:

    bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

  2. 点击Qt Tap: 点击 Qt 水龙头即可访问 Qt 公式:

    bash 酿造龙头卡特/qt5

  3. 安装Qt5: 使用以下命令安装 Qt5:

    bash 酿造安装qt@5

  4. 设置环境变量: Homebrew 将提供有关如何设置必要的环境变量的说明。按照这些说明进行操作,或者您可以将以下行添加到 shell 配置文件(例如 ~/.bash_profile 或 ~/.zshrc): 重击

    导出 PATH="/usr/local/opt/qt@5/bin:$PATH" 导出 LDFLAGS="-L/usr/local/opt/qt@5/lib" 导出 CPPFLAGS="-I/usr/local/opt/qt@5/include"

    更新您的配置文件后,重新启动终端或运行 source ~/.bash_profile (或 shell 的相应文件)。

  5. 验证安装: 通过运行以下命令检查 Qt5 是否安装成功: 重击

    qmake --版本

这应该显示已安装的 Qt 的版本信息。

如果您使用不同的 shell 或具有不同的设置,请记住调整说明。

© www.soinside.com 2019 - 2024. All rights reserved.