Share with you today a good way to install the Python library. First inform me of the operating system is WIN7,PYTHON3.5,ANACONDA3 scientific computing platform (built-in Jupyter notebook); Secondly, I also assume that you have already used pip install PackageName (installation package name) and Conda Install the PackageName method.
If you want to play scientific computing such as data analysis, machine learning and computer vision, I suggest that you install the Anaconda computing platform directly, Anaconda has helped you integrate a number of libraries for calculations, such as NumPy, Scikit learn, and matplotlib packages. However, if you think that installing anaconda, learning to use PIP install PackageName and Conda install PackageName can install the library you want, then you want to be simple.
For example, to download OpenCV, type Conda install OPENCV, the results are as follows!
As you can see from the diagram, Windows does not have 64-bit channels and downloads are not installed. Wait and see with Pip install OpenCV,
How to do it. At this point we have to install the. WHL file, there is a rich Python library URL, many libraries in the PyPI community can not find the library you will find here. URL: http://www.lfd.uci.edu/~gohlke/pythonlibs/. Click to enter, press the shortcut key ctrl+f, enter OPENCV, click the results of the search.
Then, according to the Python version and the operating system, select the corresponding. whl file, click Download.
Open the Anaconda Prompt,anaconda command line, locate the directory where you downloaded the. whl file, switch in, and then pip install. WHL file.
。
Finally we open Jupyter Notebook, import import Cv2 try
Import OS
import Matplotlib.pyplot as plt
import cv2
os.chdir ("C://users//administrator//pictures") # Switch to the path img=cv2.imread the picture
("1.jpg", 0) #读取图片
cv2.imshow ("A", img) #显示图片
Results no error:
As for my anaconda why can't read the picture, I am not clear ...
This allows you to successfully install the library you want, and is a great time saver.