先附上OpenCV官网安装的参考文档(不要照做,下文有更简单的方法)
https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_setup/py_table_of_contents_setup/py_table_of_contents_setup.html#py-table-of-content-setup
工作中涉及到操作摄像头的事情,之前在工作机按照教程的步骤在Python2.7环境装了一个,今天用家里的PC打算写个demo,但Python装的是Python3.6(电脑买来没装2.7的原因是跟随Python潮流,打算摒弃Python2)
之前粗略的看了OpenCV的文档,原本以为OpenCV只不支持Python3,后来感觉不合理啊,就在pypi.python.org上搜了一下opencv的关键字。
这个页面:https://pypi.python.org/pypi/opencv-python/3.3.0.10
果然!大部分程序员写文档真的是懒得更新啊。。。拉到页面底部发现cp36的字样,尼玛当然支持Python36了!更坑爹的是其实用pip安装就好了!真不明白参考文档中写的安装步骤写的是个啥。哥们直接来个pip install opencv-python就可以了!(用Python2.7的同学也可以直接用pip)
突然有感于Python的思想:Simple is better than complex.
再次重温import this
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
以上!
网友评论