我想安装 openCV 来矢量化图像,但是有一系列关于 Xcode 和 Ruby 的错误消息。
首先,我使用终端安装openCV,brew install opencv
。
然后,我收到错误消息,指出系统不喜欢我的 ruby 版本。
/usr/local/Homebrew/Library/Homebrew/brew.rb:12:in `<main>':
Homebrew must be run under Ruby 2.3! You're running 2.0.0. (RuntimeError)
所以,我想升级我的 ruby 。我遵循了 this 中的几个更新策略邮政。第一次 ruby 升级试用:brew link --overwrite ruby
& brew unlink ruby && brew link ruby
并获取
Error: No such keg: /usr/local/Cellar/ruby
然后第二次 ruby 升级试验:brew upgrade ruby
并看到以下错误消息。
Error: Xcode alone is not sufficient on Sierra.
Install the Command Line Tools:
xcode-select --install
此错误消息意味着我需要安装我已经安装的 Xcode。因此,我使用 code-select -p
检查我的 Xcode 状态并获得 /Applications/Xcode.app/Contents/Developer
这意味着我很好。
我看到一个comment关于在哪里安装 python 可能是个大问题。引用来源:
If you see
/usr/local/bin/python3
then you are correctly using the Homebrew version of Python. If the output is instead/usr/bin/python3
then you are incorrectly using the system version of Python.
我检查 which python3
并得到
/Users/******/anaconda3/bin/python3
这会是问题所在吗?如何将系统版本更改为本地?
最佳答案
让我自己解释一下,这样人们就不会犯同样的错误。
当我看到错误信息的最后一行时
Error: Xcode alone is not sufficient on Sierra.
Install the Command Line Tools:
xcode-select --install
我的想法是:我已经有 Xcode 为什么系统要求我“重新安装”它。但是,感谢@SamiKuhmonen @Beartech @patrick kuang 的建议,我搜索了 page (普通话)。 xcode-select --install
不会重新安装整个 Xcode。这意味着安装一些缺少的命令行工具,这是安装 Ruby 所必需的。
关于ruby - 错误消息 "Xcode alone is not sufficient on Sierra",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47460085/