[更新:我遵循了 GitHub 问题#43中提到的解决方案,但它对我不起作用!仍然导致同样的错误。]
我有 PyTorch 版本 1.9.0,我正在尝试在我的 Mac OS Ventura 上安装签名版本 1.2.6。我在终端上运行以下命令(参考:签名安装)创建虚拟环境:
pip install signatory==1.2.6.1.9.0 --no-cache-dir --force-reinstall
这给了我以下结果:
Downloading signatory-1.2.6.1.9.0.tar.gz (62 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.8/62.8 kB 1.7 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Building wheels for collected packages: signatory
Building wheel for signatory (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [111 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-cpython-38
creating build/lib.macosx-10.9-x86_64-cpython-38/signatory
copying src/signatory/signature_inversion_module.py -> buil
...
...
...
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for signatory
Running setup.py clean for signatory
Failed to build signatory
ERROR: Could not build wheels for signatory, which is required to install pyproject.toml-based projects
我在谷歌上搜索过,但没有发现与此相关的内容
ERROR: Could not build wheels for signatory, which is required to install pyproject.toml-based projects
。
任何建议将不胜感激!谢谢。
找到解决方案了!我正在一步步写下我的经验以及解决我的问题的方法,以防其他人遇到同样的问题。
对于 MacOS,命令
pip install signatory==1.2.6.1.9.0 --no-cache-dir --force-reinstall
不起作用。对于 MacOS,请运行以下命令(感谢作者amandlek):
brew install llvm
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"
export CPPFLAGS="-I/opt/homebrew/opt/llvm/include"
MACOSX_DEPLOYMENT_TARGET=13.4.1 CC=clang CXX=clang++ pip install signatory==1.2.6.1.9.0 --no-binary signatory
注意,这里的13.4.1是我的MacOS版本。上述代码行应该成功安装签名者,没有任何错误。如果没有,请进一步阅读。
现在就我而言,运行第一行代码后出现错误:
zsh: command not found: brew
因此我必须按照此链接在我的Mac上安装brew。总而言之,我必须依次运行以下 3 行代码来安装 brew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/$USER/.zprofile
eval $(/opt/homebrew/bin/brew shellenv)
运行上述命令后,必须重新启动设备,而我一开始没有重新启动设备,我认为这就是错误仍然存在并且签名安装不成功的原因。
因此,如果使用 brew 的代码不起作用,请尝试重新启动您的设备,然后再次仅运行
MACOSX_DEPLOYMENT_TARGET=13.4.1 CC=clang CXX=clang++ pip install signatory==1.2.6.1.9.0 --no-binary signatory
命令,这应该会成功安装签名!
注意:在虚拟环境中执行所有这些操作是一种良好且安全的做法。