Copy DLL to Solve VC Runtime DLL Missing Issues

This commit is contained in:
XXXXRT666 2025-05-15 12:59:06 +01:00
parent 28f3acca08
commit d4e729fed2
4 changed files with 34 additions and 11 deletions

View File

@ -52,6 +52,24 @@ $tar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1
& "C:\Program Files\7-Zip\7z.exe" x $tar.FullName -o"$tmpDir\extracted" -aoa
Move-Item "$tmpDir\extracted\python\install" "$srcDir\runtime"
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vsPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
$redistRoot = Join-Path $vsPath "VC\Redist\MSVC"
Get-ChildItem $redistRoot
$targetVer = Get-ChildItem -Path $redistRoot -Directory |
Where-Object { $_.Name -match "^14\." } |
Sort-Object Name -Descending |
Select-Object -First 1
$x64Path = Join-Path $targetVer.FullName "x64"
Write-Host 111
Get-ChildItem $x64Path
Get-ChildItem -Path $x64Path -Directory -Filter "Microsoft.*" | ForEach-Object {
Get-ChildItem -Path $_.FullName -Filter "*.dll" | ForEach-Object {
Write-Host "Copy $($_.FullName)"
Copy-Item -Path $_.FullName -Destination "$srcDir\runtime" -Force
}
}
function DownloadAndUnzip($url, $targetRelPath) {
$filename = Split-Path $url -Leaf
$tmpZip = "$tmpDir\$filename"

View File

@ -7,24 +7,22 @@ import warnings
import zipfile
from typing import Any, Dict, List, Tuple
from opencc import OpenCC
warnings.filterwarnings("ignore")
import numpy as np
import onnxruntime
import requests
onnxruntime.set_default_logger_severity(3)
onnxruntime.preload_dlls()
import torch
from opencc import OpenCC
from pypinyin import Style, pinyin
from transformers import AutoTokenizer
from transformers.models.auto.tokenization_auto import AutoTokenizer
from ..zh_normalization.char_convert import tranditional_to_simplified
from .dataset import get_char_phoneme_labels, get_phoneme_labels, prepare_onnx_input
from .utils import load_config
onnxruntime.set_default_logger_severity(3)
onnxruntime.preload_dlls()
warnings.filterwarnings("ignore")
model_version = "1.1"

View File

@ -1,2 +1,6 @@
set "SCRIPT_DIR=%~dp0"
set "SCRIPT_DIR=%SCRIPT_DIR:~0,-1%"
cd /d "%SCRIPT_DIR%"
set "PATH=%SCRIPT_DIR%\runtime;%PATH%"
runtime\python.exe -I webui.py zh_CN
pause

View File

@ -1,4 +1,7 @@
$ErrorActionPreference = "SilentlyContinue"
chcp 65001
& "$PSScriptRoot\runtime\python.exe" -I "$PSScriptRoot\webui.py" zh_CN
Set-Location $PSScriptRoot
$runtimePath = Join-Path $PSScriptRoot "runtime"
$env:PATH = "$runtimePath;$env:PATH"
& "$runtimePath\python.exe" -I "$PSScriptRoot\webui.py" zh_CN
pause