码迷,mamicode.com
首页 > 编程语言 > 详细

Windows7在Eclipse中配置Python2.7+OpenCV

时间:2018-01-30 19:39:13      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:6.2   cin   super   class   cut   ret   named   network   read   

1.从http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u2-download-1377129.html下载jdk-7u2-windows-i586.exe,安装到D:\ProgramFiles\Java,

并将D:\ProgramFiles\Java\jdk1.7.0_02\bin添加到环境变量中;

2. 从http://www.eclipse.org/downloads/下载Eclipse Classic版本并解压缩;

3. 从http://www.python.org/下载python-2.7.3.msi安装到D:\Python27目录下,并将D:\Python27添加到环境变量Path中;

4. 从https://sourceforge.net/projects/pydev/files/下载PyDev2.7.1,解压缩,生成features和plugins两个文件夹;

5. 将PyDev2.7.1/features和PyDev2.7.1/plugins两个文件夹拷贝到eclipse/dropins文件夹下,重启Eclipse;

7. 将PyDev2.7.1/features里的内容拷贝到eclipse/features文件夹下,将PyDev2.7.1/plugins里的内容拷贝到eclipse/plugins文件夹下;

8. 重启eclipse,

Window-->Preferences-->PyDev-->Editor-->Interpreter–Python:点击New…,Interpreter Name:Python2.7.1,Interpreter Executable: D:\Python27\python.exe,点击OK,弹出Selection needed对话框-->Select All,点击OK,点击OK;

9. 测试是否搭建正确:File-->New-->Project…-->选择PyDev下的PyDev Project-->Next,Project name:TestPython, Project type:Python,Grammar Version:2.7, Interpreter:Python2.7.1,选中Create ‘src’ folder and add it to thePYTHONPATH,点击Finish;

10. 选中TestPython,右键单击-->New-->Other…-->选中Pydev下的PyDev &Module-->Next-->Name:Test-->Finish;输入一条语句: print “hello world!” ,点击Run-->Run As-->Python Run,正确运行,配置成功;

11.下载安装OpenCV2.3.1:

http://blog.csdn.net/fengbingchun/article/details/7288079;

12.从https://sourceforge.net/projects/numpy/下载numpy-1.6.2-win32-superpack-python2.7安装;

13.    将OpenCV2.3.1文件夹下build-->python-->2.7文件夹下的所有文件复制到D:\Python27\Lib\site-packages中,双击D:\soft\OpenCV2.3.1\opencv\samples\python文件夹下的drawing.py文件,如果能够正确运行,说明配置正确;

14、最终测试:在Test.py文件中输入以下语句,运行正确。

#show an image

 

print"cinterface"

 

import cv2.cvas cv

 

im = cv.LoadImage("E:\\Python\\1.jpg")

cv.NamedWindow("Source") 

cv.ShowImage("Source", im) 

cv.WaitKey(0)

 

print"c++interface"

 

import cv2

 

im = cv2.imread("E:\\Python\\1.jpg")

cv2.namedWindow("Source")

cv2.imshow("Source", im)

cv2.waitKey(0)

 

参考文献:

1、 http://www.ourunix.org/post/320.html

2、 http://pydev.org/manual_101_install.html

3、 http://www.linuxso.com/linuxbiancheng/10600.htmll

4、 http://www.cnblogs.com/huzhiwei/archive/2012/09/07/2674676.html

5、 http://www.cr173.com/html/7367_1.html

 

原文链接:http://blog.csdn.net/fengbingchun/article/details/8187446#comments

 

Windows7在Eclipse中配置Python2.7+OpenCV

标签:6.2   cin   super   class   cut   ret   named   network   read   

原文地址:https://www.cnblogs.com/ddhdd/p/8386209.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!