\u56e0\u4e3amacOS\u7cfb\u7edf\uff08\u5305\u62ecMac OS X\u7cfb\u7edf\uff09\u81ea\u5e26python\u5b89\u88c5\uff0c\u4f46\u56e0\u4e3a\u64cd\u4f5c\u7cfb\u7edf\u672c\u8eab\u4f9d\u8d56\u4e14\u7248\u672c\u8f83\u4f4e\uff0c\u8fd9\u91cc\u91c7\u7528Homebrew\u5b89\u88c5\u9694\u79bb\u7684python\u73af\u5883\uff0cHomebrew\u7684\u7279\u6027\u8fd9\u91cc\u4e0d\u4f5c\u5ef6\u5c55\uff0c\u540e\u7eed\u4e13\u95e8\u5199\u4e00\u7bc7\u4ecb\u7ecd.<\/p>\n
brew tap homebrew\/science<\/p>\n
brew install opencv<\/p><\/blockquote>\n
\u5b89\u88c5\u7ed3\u675f\u540e opencv\u4f1a\u88ab\u5b89\u88c5\u5230\u00a0\/usr\/local\/Cellar\/opencv\/2.4.13.2\/ \u76ee\u5f55<\/p>\n
python\u8c03\u7528opencv\u662f\u901a\u8fc7\u00a0\/usr\/local\/Cellar\/opencv\/2.4.10\/lib\/python2.7\/site-packages\/ \u76ee\u5f55\u4e0b\u9762\u7684<\/p>\n
cv.py<\/em><\/strong><\/p>\ncv2.so<\/em><\/strong><\/p>\n\u4e24\u4e2a\u6587\u4ef6\u5b9e\u73b0\u7684\uff0c\u8fd9\u4e24\u4e2a\u5176\u5b9e\u5c31\u662fopencv\u7684python\u5bf9\u5e94\u7248\u672c\u7684\u6269\u5c55\uff0c\u5c06\u5b83\u4eec\u4e0epython\u6269\u5c55\u5305\u5f15\u7528\u8def\u5f84\u5173\u8054\u8d77\u6765\u5c31\u53ef\u4ee5\u4e86<\/p>\n
cd\u00a0\/usr\/local\/lib\/python2.7\/site-packages\/
\nln -s \/usr\/local\/Cellar\/opencv\/2.4.10\/lib\/python2.7\/site-packages\/cv.py cv.py
\nln -s \/usr\/local\/Cellar\/opencv\/2.4.10\/lib\/python2.7\/site-packages\/cv2.so cv2.so<\/p><\/blockquote>\n
\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e0b\u9762\u6267\u884c<\/p>\n
import cv2<\/p>\n
\u53ef\u4ee5\u6b63\u5e38\u5f15\u7528\u5219\u5b89\u88c5\u6b63\u786e<\/p>\n
\u5982\u679c\u51fa\u73b0\u4ee5\u4e0b\u60c5\u51b5\u5219\u9700\u8981\u5b89\u88c5 numpy\u548cmatplotlib\u6269\u5c55<\/p>\n
>> import cv2
\nImportError: numpy.core.multiarray failed to import
\nTraceback (most recent call last):
\nFile “<stdin>”, line 1, in <module>
\nImportError: numpy.core.multiarray failed to import<\/p><\/blockquote>\n
<\/p>\n
\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u5373\u53ef\uff1a<\/p>\n
pip install numpy
\npip install matplotlib<\/p><\/blockquote>\n
<\/p>\n
\u9898\u56fe\uff1a\u82b1\u74e3\u7f51<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"\u56e0\u4e3amacOS\u7cfb\u7edf\uff08\u5305\u62ecMac OS X\u7cfb\u7edf\uff09\u81ea\u5e26python\u5b89\u88c5\uff0c\u4f46\u56e0\u4e3a\u64cd\u4f5c\u7cfb\u7edf\u672c\u8eab\u4f9d\u8d56\u4e14\u7248\u672c\u8f83\u4f4e\uff0c\u8fd9\u91cc\u91c7\u7528 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[121,155,1],"tags":[153,151,152],"_links":{"self":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1749"}],"collection":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/comments?post=1749"}],"version-history":[{"count":5,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1749\/revisions"}],"predecessor-version":[{"id":1755,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1749\/revisions\/1755"}],"wp:attachment":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/media?parent=1749"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/categories?post=1749"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/tags?post=1749"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}