目录
1.报错1
mac本用brew报如下错误:
xialiangzhideMacBook-Pro:~ xialz$ brew install opencv
Traceback (most recent call last):
11: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `<main>'
10: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `require_relative'
9: from /usr/local/Homebrew/Library/Homebrew/global.rb:29:in `<top (required)>'
8: from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
7: from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
6: from /usr/local/Homebrew/Library/Homebrew/os.rb:3:in `<top (required)>'
5: from /usr/local/Homebrew/Library/Homebrew/os.rb:21:in `<module:OS>'
4: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:58:in `prerelease?'
3: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:24:in `version'
2: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:24:in `new'
1: from /usr/local/Homebrew/Library/Homebrew/os/mac/version.rb:26:in `initialize'
/usr/local/Homebrew/Library/Homebrew/version.rb:368:in `initialize': Version value must be a string; got a NilClass () (TypeError)
2. 解决方案
网上上搜索以后,有的说是因为brew只支持正式发行版。/usr/local/Homebrew/Library/Homebrew/version.rb文件中第368行直接用@version = '10.14.1’给定一个版本号就可以了。但是我修改了以后,没有用。因为每次启动brew命令后/usr/local/Homebrew/Library/Homebrew/version.rb文件就会恢复为原来的样子,错误依旧。
没有办法,那么就重置吧:brew update-reset然后就OK了。
参考链接:http://www.manongjc.com/detail/41-jhgtmblbewnpkjn.html
3. 报错2
brew install opencv
==> Downloading https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:1f50bf80583bd436c9542d4fa5ad47df0ef0f0bea22ae710c4f04c42d7560bca
Already downloaded: /Users/xialz/Library/Caches/Homebrew/portable-ruby-2.6.8_1.el_capitan.bottle.tar.gz
Error: Checksum mismatch.
Expected: 1f50bf80583bd436c9542d4fa5ad47df0ef0f0bea22ae710c4f04c42d7560bca
Actual: 6ae9f559ac4f90b92cae96c25a7486ee389ec0d7082910344a1afaf85ae6b301
Archive: /Users/xialz/Library/Caches/Homebrew/portable-ruby-2.6.8_1.el_capitan.bottle.tar.gz
To retry an incomplete download, remove the file above.
Error: Failed to upgrade Homebrew Portable Ruby!
4. 解决方案
4.1 原因分析
是由于文件portable-ruby-2.6.8_1.el_capitan.bottle.tar.gz下载失败导致的
4.2 手动下载portable-ruby-2.6.8_1.el_capitan.bottle.tar.gz
https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.8_1/portable-ruby-2.6.8_1.el_capitan.bottle.tar.gz
4.3 拷贝portable-ruby-2.6.8_1.el_capitan.bottle.tar.gz到指定目录
cp portable-ruby-2.6.8_1.el_capitan.bottle.tar.gz /Users/xialz/Library/Caches/Homebrew/
=mac上使用clion搭建opencv开发环境=
mac上使用clion搭建opencv开发环境