今天执行pip install tesserocr
时遇到了些麻烦,折腾了半天终于解决。
首先是出现 file 'ios' not found错误,这是找不到名为ios的头文件,需要手动指定一下include的路径,于是执行CPPFLAGS=-I/Library/Developer/CommandLineTools/usr/include/c++/v1 pip install tesserocr
这个命令,结果出现了新的错误:ld: library not found for -lstdc++
,这是缺少了一个lib导致,解决方法如下:
- 找到
libstdc++.6.0.9.tbd
这个文件,可以百度或者从xcode9里找,xcode10把这个库删了 - 把这个文件复制到
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib
这个路径下,然后创建两个soft link,分别命名为libstdc++.6.tbd
和libstdc++.tbd
- 执行以下命令
CPPFLAGS="-I/Library/Developer/CommandLineTools/usr/include/c++/v1 -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib" pip install tesserocr
即可成功安装