程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

[handy notes] opencv python+vscode environment construction

編輯:Python

OpenCV python Environmental installation

After many detours , I find , In the use of anaconda install OpenCV when , It is easy for the server not to respond , After all, across the wall , While using domestic , Such as anaconda When installing Tsinghua source , Some servers will not respond , Cause installation to fail .、
And if you use pip install , There is no way to solve the dependency problem , Direct installation OpenCV The result is still failure .
After trying many ways , I finally found a more reliable way .
Reference link : Zhihu tutorial
But there are still some problems when using this method , That is the lack of VideoCapture This library that calls the camera . Therefore, we still have to solve the problem of dependency , Install some dependency packages .
ad locum , I'm ready , Include OpenCV And some dependent packages , Click here to jump directly download
After downloading, unzip , Then open the Windows Medium cmd, Shortcut :win+R After the key , Input cmd And then go back .

Then use the command to go to the directory where the installation package is located . For example, mine is E Under the plate , Then I can transfer the directory to that folder in the following way .


Is the disk where the input file is located , I was in E disc , Then type in E:, And then go back , And then use cd command , I was in E On the plate python Under the folder opencv Folder , So you can use this method . Of course , If you are afraid of losing wrong , You can use copy and paste , You can also use tab Key completion , That is, first input a few words or letters in front of the file , Then press tab Key can be automatically supplemented .
After installation anaconda after , You can use pip Command to install the third-party library . The documents here are only applicable to python3.7 Of , That is to say, it must be installed anaconda3 Can only be .
Use... Sentence by sentence on the command line pip install Command to install , It's still recommended to use tab Key to complete the file name , however pip install This command must be typed by hand or copied and pasted .

pip install opencv_python-3.4.9.33-cp37-cp37m-win_amd64.whl
pip install VideoCapture-0.9.5-cp37-cp37m-win_amd64.whl
pip install Pillow-8.0.1-cp37-cp37m-win_amd64.whl

Enter every time you type a sentence , And you must see the prompt of successful installation .
If all installations are successful , Then you can refer to another article about haar Face detection article to test opencv.

anaconda3 as well as vscode Considerations for development environment

The first point , In the installation anaconda3 when , You must add it to the environment variable

That is, you will be prompted during the installation , As shown in the picture below , Just check the two .

Second point , install vscode after , To install python plug-in unit


If you don't see any python The name of the plug-in , You can also search for the installation .
Of course ,vscode It also supports simplified Chinese , Similarly, you need to install plug-ins .

After installation, you only need to restart vscode This software can be converted into a simplified Chinese interface .
Of course , To verify your python Whether the environment can be used , It is recommended to run one randomly python Program to test .

among F5 The key is python Shortcut keys for program operation


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved