根据教程,我正在尝试在Mac(OS High Sierra)上安装OpenCV
here
进行了一些小的修改。为了完整起见,到目前为止,我已经做了以下工作:
sudo xcode-select --install
export PATH=/usr/local/bin:$PATH >> /.bashrc
source ~/.bashrc
brew install python python3
brew link python
brew link python3
brew postinstall python3
pip3 install virtualenv virtualenvwrapper
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 >> /.bashrc
export WORKON_HOME=$HOME/.virtualenvs PROJECT_HOME=$HOME/Develsource/usr/local/bin/virtualenvwrapper.sh >> /.bashrc
brew install opencv
echo /usr/local/opt/opencv/lib/python3.6/site-packages >> /usr/local/lib/python3.6/site-packages/opencv3.pth
这一切似乎都很好。在上面,我更改了教程的
WORKON_HOME
到
virtualenvs
而不是
virtualenvsexport
。
然后我进入虚拟环境:
mkvirtualenv cv-py3 -p python3
workon cv-py3
pip install numpy scipy scikit-image matplotlib scikit-learn
deactivate
现在我返回并链接OpenCV:
cd ~/.virtualenvs/cv-py3/lib/python3.6/site-packages/
ln -s /usr/local/opt/opencv@3/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so cv2.so
现在问题来了:
workon cv-py3
python3
import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/JosephBullock/.virtualenvs/cv-py3test/lib/python3.6/site-packages/cv2.so, 2): Library not loaded: /usr/local/opt/tesseract/lib/libtesseract.3.dylib
Referenced from: /usr/local/Cellar/opencv/3.4.1_3/lib/libopencv_text.3.4.dylib
Reason: image not found
就是在这里,我不知道哪里出了问题,该怎么办。