使用brew的macOS python3,导入cv2时出错

时间:2019-10-11 13:11:32

标签: python python-3.x macos numpy opencv

我通过brew在macOS中安装了python3,
我安装了opencv和numpy,
在导入cv2和numpy时出现此错误

modify as below and try 

    @Override
  protected void configure(HttpSecurity http) throws Exception {
    http.cors().and().csrf().disable().anonymous().disable().authorizeRequests()
                     .antMatchers("/api/auth/**")
                        .permitAll()
                    .antMatchers(HttpMethod.GET, "/api/**", "/api/**")
                        .permitAll();

}

1 个答案:

答案 0 :(得分:0)

我以这种方式解决了这个问题:

  • 我使用brew安装了opencv

brew install opencv

  • 我为python安装了opencv

pip install opencv-python

  • 我删除了(坏的)numpy库

sudo rm -rf /usr/local/lib/python3.7/site-packages/numpy

  • 我将numpy库与工作库相关联

sudo ln -s /usr/local/Cellar/numpy/1.17.1/lib/python3.7/site-packages/numpy /usr/local/lib/python3.7/site-packages/numpy