当前位置:网站首页>Cannot find reference 'imread' in 'appears in pycharm__ init__. py‘

Cannot find reference 'imread' in 'appears in pycharm__ init__. py‘

2022-06-24 22:00:00 Jingwen · red spirit

import cv2
import requests
from selenium import webdriver
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait as Wait

driver = webdriver.Chrome()  #  establish Chrome object 
# driver.get('https://www.baidu.com')  #  Visit Baidu .
driver.get("https://www.douban.com/")

driver.implicitly_wait(20)

driver.switch_to.frame(driver.find_element(By.XPATH,"//*[@id='anony-reg-new']/div/div[1]/iframe"))
driver.find_element(By.XPATH, "/html/body/div[1]/div[1]/ul[1]/li[2]").click()

driver.find_element(By.XPATH, "//*[@id='username']").send_keys("17600299304")
driver.find_element(By.XPATH, "//*[@id='password']").send_keys("17600299304")
driver.find_element(By.XPATH, "/html/body/div[1]/div[2]/div[1]/div[5]").click()
driver.switch_to.frame(driver.find_element(By.XPATH,'//*[@id="tcaptcha_iframe"]'))
# Big_img=driver.find_element(By.XPATH,'//*[@id="slideBg"]')
Big_img=driver.find_element(By.XPATH,'//*[@id="cdn1"]')

# //*[@id="cdn1"]
# Sim_img=driver.find_element(By.XPATH,'//*[@id="slideBlock"]')
Sim_img=driver.find_element(By.XPATH,'//*[@id="cdn2"]')
Big_url=Big_img.get_attribute('src')
Sim_url=Sim_img.get_attribute('src')
print(Big_url)
print(Sim_url)

#  Download the slider and petal map to local 

with open('11/Big_images.jpg', 'wb') as f:
    f.write(requests.get(Big_url).content)
    f.close()
with open('11/Sim_images.jpg', 'wb') as f:
    f.write(requests.get(Sim_url).content)
    f.close()

# AI matching slider verifies distance 

cv2.imread()

https://blog.csdn.net/m0_60258123/article/details/121416424icon-default.png?t=M5H6https://blog.csdn.net/m0_60258123/article/details/121416424 In the article, through modification opencv Version of , It solves the problem perfectly , period warning, And the code prompt function can work normally .pip install -i https://pypi.douban.com/simple opencv-python==4.5.3.56,

But I have the following questions

C:\Users\euweb>pip install -i https://pypi.douban.com/simple opencv-python==4.5.3.56
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.douban.com/simple
Collecting opencv-python==4.5.3.56
  Using cached https://pypi.doubanio.com/packages/01/9b/be08992293fb21faf35ab98e06924d7407fcfca89d89c5de65442631556a/opencv-python-4.5.3.56.tar.gz (89.2 MB)
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Program Files\Python310\python.exe' 'C:\Users\euweb\AppData\Local\Temp\pip-standalone-pip-xzw6is2a\__env_pip__.zip\pip' install --ignore-installed --no-user --prefix 'C:\Users\euweb\AppData\Local\Temp\pip-build-env-gtx9nthp\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.douban.com/simple -- setuptools wheel scikit-build cmake pip 'numpy==1.13.3; python_version=='"'"'3.6'"'"' and platform_machine != '"'"'aarch64'"'"' a

https://blog.csdn.net/baidu88vip/article/details/89313548icon-default.png?t=M5H6https://blog.csdn.net/baidu88vip/article/details/89313548 Through the article pip install opencv-contrib-python Order to solve the problem , But the following problems occurred after my operation

C:\Users\euweb>pip install opencv-contrib-python
Defaulting to user installation because normal site-packages is not writeable
Collecting opencv-contrib-python
  Downloading opencv_contrib_python-4.6.0.66-cp36-abi3-win_amd64.whl (42.5 MB)
     |████████████████████████████████| 42.5 MB 352 kB/s
Collecting numpy>=1.17.3
  Using cached numpy-1.22.4-cp310-cp310-win_amd64.whl (14.7 MB)
Installing collected packages: numpy, opencv-contrib-python
  WARNING: The script f2py.exe is installed in 'C:\Users\euweb\AppData\Roaming\Python\Python310\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed numpy-1.22.4 opencv-contrib-python-4.6.0.66
WARNING: You are using pip version 21.2.4; however, version 22.1.2 is available.
You should consider upgrading via the 'C:\Program Files\Python310\python.exe -m pip install --upgrade pip' command.

 

原网站

版权声明
本文为[Jingwen · red spirit]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206241519100962.html