Windows7在Eclipse中配置Python2.7+OpenCV

來源:互聯網
上載者:User

標籤: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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.