Goals

In this tutorial
  • We will learn to setup OpenCV-Python in your Windows system.

Below steps are tested in a Windows 7-64 bit machine with Visual Studio 2010 and Visual Studio 2012. The screenshots shows VS2012.

Installing OpenCV from prebuilt binaries

  1. Below Python packages are to be downloaded and installed to their default locations.

    1.1. Python-2.7.x.

    1.2. Numpy.

    1.3. Matplotlib (Matplotlib is optional, but recommended since we use it a lot in our tutorials).

  2. Install all packages into their default locations. Python will be installed to C:/Python27/.

  3. After installation, open Python IDLE. Enter import numpy and make sure Numpy is working fine.

  4. Download latest OpenCV release from sourceforge site and double-click to extract it.

  1. Goto opencv/build/python/2.7 folder.

  2. Copy cv2.pyd to C:/Python27/lib/site-packages.

  3. Open Python IDLE and type following codes in Python terminal.

    >>> import cv2
    >>> print cv2.__version__

If the results are printed out without any errors, congratulations !!! You have installed OpenCV-Python successfully.

http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_setup/py_setup_in_windows/py_setup_in_windows.html

补充:

第一个:win7下安装Python +matplotlib

终于安装好了Python +matplotlib特此记录下。感谢以下几个文字的作者给我的帮助,同时大家也可以参考这几个作者的方法:

1、http://www.open-open.com/lib/view/open1393488232380.html

2、http://blog.csdn.net/yang6464158/article/details/18546871#comments

3、http://blog.sina.com.cn/s/blog_6fb8aa0d0101qtt9.html

4、http://www.cnblogs.com/qianlifeng/archive/2012/02/13/2350086.html

5、http://jingyan.baidu.com/article/fdffd1f8390029f3e98ca102.html

同时附上安装程序下载的地址http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy

一、安装python

首先先安装好python 因为3.X版本很多库不兼容,所以还是使用2.7的。python下载地址https://www.python.org/download/我用的是64位的。整体而言,整个安装过程,如果用64的包就所有的包都需要用64的,不然会有问题。

二、安装matplotlib(在安装的时候,如果出现Python version 2.7 required, which was not found in the registry这样的问题,请参见http://blog.csdn.net/bush2582/article/details/39928049)

安装matplotlib最好选择1.3.0.版本的,不然会出现一个ImportError: six 1.3 or later is required; you have 1.2.0这样的问题。 下载之后,点击安装即可。

三、安装dateutil,pyparsing,scipy

这三个库,都是在运行的时候需要的,缺失不同的库,会导致不同的错误:1、dateutil:raise ImportError("matplotlib requiresdateutil")ImportError: matplotlib requires dateutil2、pyparsing:raise ImportError("matplotlib requirespyparsing")ImportError: matplotlib requires pyparsing3、scipy:

No module name six

在安装完毕scipy之后把C:/Python27/Lib/site-packages/scipy/lib中的six.py six.pyc six.pyo三个文件拷贝到C:/Python27/Lib/site-packages目录下。

四、安装NumPy

安装NumPy的时候需要特别注意,如果你前面的包都是64的请安装64位的NumPy不然会出现例如如下的错误:

Traceback (most recent call last):

File "D:/works/JetBrains/python/simplePref/test.py", line 5, in <module>

import matplotlib.pyplot as plt; plt.rcdefaults()

File "C:/Python27/lib/site-packages/matplotlib/__init__.py", line 156, in <module>

from matplotlib.cbook import is_string_like

File "C:/Python27/lib/site-packages/matplotlib/cbook.py", line 28, in <module>

import numpy as np

File "C:/Python27/lib/site-packages/numpy/__init__.py", line 153, in <module>

from . import add_newdocs

File "C:/Python27/lib/site-packages/numpy/add_newdocs.py", line 13, in <module>

from numpy.lib import add_newdoc

File "C:/Python27/lib/site-packages/numpy/lib/__init__.py", line 8, in <module>

from .type_check import *

File "C:/Python27/lib/site-packages/numpy/lib/type_check.py", line 11, in <module>

import numpy.core.numeric as _nx

File "C:/Python27/lib/site-packages/numpy/core/__init__.py", line 6, in <module>

from . import multiarray

ImportError: DLL load failed: %1 不是有效的 Win32 应用程序。

同时64的NumPy包的名字是numpy-MKL-1.8.1.win-amd64-py2.7.exe,请注意。

五、安装完毕测试

安装好了之后,可以填入如下的测试程序(测试程序源于http://www.open-open.com/lib/view/open1393488232380.html)

第二个:

Python安装windows系统

本文主要介绍win8 64位 Python2.7的配置

相关资源:

Python2.7+numpy 1.8.0.win64 :

http://download.csdn.net/detail/am45337908/9218417

matplotlib1.3.1+pyparsing2.0.3+dateutil2.2+scipy0.13.1 for python2.7:

http://download.csdn.net/detail/am45337908/9218431

在资源中下载python2.7安装包,安装好python2.7后

1.依次安装numpy、matplotlib、pyparsing、dateutil、scipy,这几个可执行程序,可以自动辨认python安装的路径,并且安装在D:\Python27\Lib\site-packages下

这里主要说一下Python的路径设置:

计算机---->右键属性---->高级系统设置----->环境变量---->点击系统变量的path

添加你安装path 的路径如图 这里为D:\Python27;

然后在cmd命令行输入 python -V   就看到python信息了,这里一定要大V哦

2.将D:\Python27\Lib\site-packages\scipy\lib中的six.py six.pyc six.pyo三个文件拷贝到D:\Python27\Lib\site-packages目录下。注:D:\Python27为我安装python的位置。然后查看D:\python27\Lib\site-packages 如图

3.检测numpy、matplotlib是否安装成功

打开dos,先输入python,正确安装如图

然后分别输入from numpy import *

import matplotlib

import matplotlib.pyplot as plt

do not forget

  • Goto opencv/build/python/2.7 folder.

  • Copy cv2.pyd to C:/Python27/lib/site-packages.

for ubuntu16.04

进入到opencv,执行mkdir build,进入build,执行cmake -D CMAKE_INSTALL_PREFIX=/usr/local -D CMAKE_BUILD_TYPE=Release -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules .. ;然后执行make -j8,最后执行sudo make install

最新文章

  1. 前端性能优化---yahoo军规
  2. Win10激活KMS
  3. Windows 10 开始菜单修改程序
  4. easyUI之message
  5. windows下找不到strings.h
  6. android 安装包签名问题探究
  7. Java_类和对象(完美总结)_转载_覆盖和隐藏的区别,覆盖就不能使用了,而隐藏提供全局方法名或者全局变量名还可以使用
  8. java04 Sacnner的使用
  9. Python线程:线程的调度-守护线程
  10. Mybatis使用过程问题总结
  11. 在github上最热门好评高的ROS相关功能包
  12. TensorFlow GPU版本号与CUDA的对应产生的错误
  13. Ubuntu 14.04 下安装 OpenCV
  14. window.history.go(-1)返回且刷新页面 点击返回上一层
  15. jq优化
  16. django基础 -- 9.中间件
  17. Codeforces-Anastasia and pebbles
  18. Python之路PythonThread,第三篇,进程3
  19. 每日英语:China&#39;s Wistful Wen Gets His Wish
  20. 【转】每天一个linux命令(60):scp命令

热门文章

  1. 最近两周我们接触到的两种线上抓娃娃机的技术实现方案(一种RTSP/一种RTMP)
  2. maven官网下载安装步骤
  3. C#获取网页内容的三种方式(转)
  4. 九度OJ 1058:反序输出 (基础题)
  5. 2017-2018-1 20179209《Linux内核原理与分析》第四周作业
  6. react-navigation遇到的坑
  7. ABAP upload file(*.txt *.csv *.xls)
  8. abap 数字移动小游戏
  9. CodeForces - 799B T-shirt buying 【贪心】
  10. netstat参数记录