Reference: Using OpenCV with Python @Mac --Qiita
According to the above, under site-packages
of my virtualenv, cv.py and cv2.so
I put a symbolic link, but when I ʻimport cv`, ** "Segmentation fault: 11" ** came out and fell. UU….
In virtualenv,
After doing brew uninstall opencv
I did brew install opencv
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'getusersitepackages'
The error is.
I didn't feel like I could go straight, so I went to ~ / .bashrc
.
# python
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:~/.virtualenvs/my_venv/lib/python2.7/site-packages:$PYTHONPATH
After adding and doing brew install opencv
again, this time the above error did not appear.
Launch python with source ~ / .bashrc
import cv
import cv2
After that, there was no segfault. It was a memo. .. ..
(For the time being, anyenv → talk under the environment of pyenv)
ʻEcho'import site; site.addsitedir ("/ usr / local / lib / python2.7 / site-packages ")' >> ~ / .pyenv / versions / {virtualenv_name} /lib/python2.7/site-packages Try /homebrew.pth` (No, maybe you should do it from the beginning).
Recommended Posts