- Method 1:
- Method 2:
This paper summarizes two methods to import opencv and numpy packages. The first is to import two packages directly in pychar, and the second is to download relevant files on the official website for configuration. I recommend the second method, because when I used the first method, I encountered the situation that the package could not be found or the package guide failed. Finally, I learned the method 2 with the help of the powerful CSDN. The successful configuration has gone through a lot of hardships ~o~
1. Open pychart, click file – > Settings – > Project: XXX – > Python interpreter, and go in.
Wait about 3 / 4 minutes, and the following figure will appear if the download is successful; If the following figure does not appear, method 2 is recommended.
Numpy package is to search numpy in the search bar, and the other operations are the same.
Download the official website link of OpenCV and numpy Guide Package: https://www.lfd.uci.edu/ ~gohlke/pythonlibs/#opencv
After entering, find the documents shown in the following two figures.
1. Choose to download the WHL file that matches the python version and the computer operating system version.
The number after CP represents the python version,For example: Python 3 Version 8 is cp38, python 3 The version of 9 is cp39.
After win stands for the number of bits of the operating system.
My operating system is 64 bit and the python version is 3.9 5, so I downloaded the following two files.
The following describes how to import opencv:
2. Find the root directory of the downloaded WHL file.
3. After entering the command prompt window, there is a “dead formula”: Full name of WHL file of PIP install opencv
As shown below:
If successful import is shown below, proceed to the next test; Otherwise enterpython -m pip install –upgrade
Then “dead formula”.
The method of importing numpy is roughly the same as that of importing opencv, and the “dead formula” becomes:Full name of WHL file of PIP install numpy
After importing the two packages, you can conduct a test.
import cv2 img = cv2.imread("C:\\Users\\tangyitao\\Pictures\\tt.jpg") cv2.namedWindow("Image") cv2.imshow("Image", img) cv2.waitKey(0) cv2.destroyAllWindows()
Run successfully! Always very cute little rabbit.
This is the end of this article about the implementation of pypharm configuring opencv and numpy. For more information about pypharm configuring opencv and numpy, please search the previous articles of developeppaer or continue to browse the relevant articles below. I hope you will support developeppaer in the future!