验证numpy是否安装的小技巧

numpy

如下

>>> from numpy import *
>>> eye(4)
array([[1., 0., 0., 0.],
       [0., 1., 0., 0.],
       [0., 0., 1., 0.],
       [0., 0., 0., 1.]])

Brew

mac更新到big sur之后,brew运行就不正常。在发现使用更新中科大源之前,我才用的是如下方法,也能解决问题,只不过在imac上可以正常安装opencv,而mac pro上则失败了,后来在两台电脑上全部重新安装了中科大版本的brew,才最终解决,下面将原操作做个记录。

  • 首先,在使用brew list或brew doctor后,出现的是下面的问题

    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:37: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)>'
  • 然后,删除xcode工具,并重新安装

    sudo rm -rf /Library/Developer/CommandLineTools
    sudo xcode-select --install
    
  • 最后,更新brew即可

    brew upgrade
    

    当然,最好的方法是

    brew update-reset
    brew cleanup
    

    参考
    brew更新问题
    更换科大brew源

Leave a Reply

Your email address will not be published. Required fields are marked *