OpenVINO无法通过在Windows 7操作系统中使用PowerShell执行来安装OpenCV



我正在尝试用Windows 7旧计算机安装openvino_2021.4.689版本。

我需要在我的项目中使用OpenCV,所以我必须使用PowerShell来执行openvino_2021.4.689的OpenCV文件夹中的ffmpeg-download.psl

如果我在命令提示符下通过pip install opencv-python安装自己的OpenCV,而不是通过OpenVINO的ffmpeg download.psl文件安装,那么我的cv2库项目将无法成功运行。

具体来说,我的YOLOv4帧将不会在没有任何错误消息的情况下显示,我使用cv2绘制图像的方法无法工作。

但是,如果我用鼠标右键单击ffmpeg-download.psl并选择由PowerShell执行,我会收到一条错误消息,如图所示。(与系统管理员一起执行。(

FATAL: Unable to write with elevated privileges: binopencv_videoio_ffmpeg45364.dll

此外,这一步骤在我的Windows 10或Windows 11操作系统中总是很顺利,它只发生在Windows 7过时的PC中。

下面是ffmpeg download.psl.中的内容

$url = "https://raw.githubusercontent.com/opencv/opencv_3rdparty/213fcd5d4897319a83207406036c4a5957fba010/ffmpeg/opencv_videoio_ffmpeg_64.dll"
$expected_md5 = "ac99f9767a83103c31709628af685924"
$output = "$PSScriptRootbinopencv_videoio_ffmpeg453_64.dll"
Write-Output ("=" * 120)
try {
Get-content -Path "$PSScriptRootetc/licensesffmpeg-readme.txt" -ErrorAction 'Stop'
} catch {
Write-Output "Refer to OpenCV FFmpeg wrapper readme notes about library usage / licensing details."
}
Write-Output ("=" * 120)
Write-Output ""
if(![System.IO.File]::Exists($output)) {
try {
[io.file]::OpenWrite($output).close()
} catch {
Write-Warning "Unable to write: $output"
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Warning "Launching with 'Administrator' elevated privileges..."
Pause
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
exit
} else {
Write-Output "FATAL: Unable to write with elevated privileges: $output"
Pause
exit 1
}
}
try {
Write-Output ("Downloading: " + $output)
Import-Module BitsTransfer
$start_time = Get-Date
Start-BitsTransfer -Source $url -Destination $output -ErrorAction 'Stop'
Write-Output "Downloaded in $((Get-Date).Subtract($start_time).Seconds) seconds"
} catch {
$_ # Dump error
try {
Write-Output ("Downloading (second attempt): " + $output)
$start_time = Get-Date
Invoke-WebRequest -Uri $url -OutFile $output
Write-Output "Downloaded in $((Get-Date).Subtract($start_time).Seconds) seconds"
} catch {
Write-Output ("Can't download file: " + $output)
Write-Output ("URL: " + $url)
Write-Output "You need to download this file manually. Stop"
Pause
Exit
}
}
} else {
Write-Output ("File exists: " + $output)
Write-Output ("Downloading is skipped. Remove this file and re-run this script to force downloading.")
}
if(![System.IO.File]::Exists($output)) {
Write-Output ("Destination file not found: " + $output)
Write-Output "Stop"
Pause
Exit
}
try {
$hash = Get-FileHash $output -Algorithm MD5 -ErrorAction 'Stop'
if($hash.Hash -eq $expected_md5) {
Write-Output "MD5 check passed"
} else {
Write-Output ("MD5     : " + $hash.Hash.toLower())
Write-Output ("Expected: " + $expected_md5)
Write-Output "MD5 hash mismatch"
}
} catch {
$_ # Dump error
Write-Output "Can't check MD5 hash (requires PowerShell 4+)"
}
Pause
Write-Output "Exit"

OpenVINO的Intel®发行版验证并支持的Windows操作系统™工具包是Windows10,64位。使用较旧的Windows版本可能会导致意外问题。

如果仅查看您当前遇到的错误,则可能是由于Windows PowerShell兼容版本所致。正如ffmpeg download.psl中所提到的,它需要PowerShell 4+。虽然Windows 7安装了默认版本Windows PowerShell 2.0。

最新更新