当前位置:网站首页>Install opencv -- CONDA to establish a virtual environment and add the kernel of this environment in jupyter

Install opencv -- CONDA to establish a virtual environment and add the kernel of this environment in jupyter

2022-07-05 06:22:00 Cold leaves elegant_

First step : Create a myopencv Virtual environment for

win+R -->cmd

conda create --name myopencv python=3.7

 Insert picture description here
The second step : download OpenCV-python

The download page :https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv

find OpenCV, Because the current python Version is 3.7, The operating system is 64 position , So download
 Insert picture description here
Download the installation file locally (D:\Anaconda3\envs\myopencv)

stay cmd Activate the environment on the command line

activate myopencv
pip install D:\Anaconda3\envs\myopencv\opencv_python-4.4.0-cp37-cp37m-win_amd64.whl

 Insert picture description here
After entering myopencv Of Python Environmental Science
 Insert picture description here
I found that I did not install numpy

sign out Python Environmental Science , stay myopencv Installation in the environment numpy

exit()
pip install numpy

 Insert picture description here

Once again into the myopencv Of Python Environmental Science

import cv2

 Insert picture description here
Installation successful !!!

sign out Python Environmental Science , View all packages included in the environment

exit()
pip list

 Insert picture description here
Found no ipykernel, Installation

pip install ipykernel

 Insert picture description here
Installation successful

Activate the default environment (base), View the current environment ( Yes * Is the current environment )

activate base
conda env base

Enter to add to jupyter Of kernel Environment , Input

python -m ipykernel install --name myopencv
Installed kernelspec myopencv in C:\ProgramData\jupyter\kernels\myopencv

take kernel Add to jupyter Of kernel In the list  Insert picture description here
see jupyter Of kernel list
 Insert picture description here
Get into jupyter View in
 Insert picture description here
Reference material :

  1. https://zhuanlan.zhihu.com/p/37050300
  2. https://zhuanlan.zhihu.com/p/37708958
  3. https://www.jianshu.com/p/7a996a7f1c9e
  4. https://blog.csdn.net/zhaoguanghe/article/details/103389302
原网站

版权声明
本文为[Cold leaves elegant_]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207050620029720.html