活动介绍
file-type

解决il2cpp中dll fullname查找问题的方法

下载需积分: 5 | 445B | 更新于2024-12-22 | 134 浏览量 | 0 下载量 举报 收藏
download 立即下载
为了解决这个问题,通常需要将需要引用的dll和包名配置到link.xml文件中。但是,link.xml文件中的assembly节点的fullname定义往往不够明确,这会导致配置无效。为了解决这一问题,可以通过压缩包中的命令来查看dll的fullname。本文将详细介绍如何通过查看dll的fullname来解决il2cpp编译坑的问题,以及如何配置link.xml文件以避免类找不到的问题。" il2cpp是Unity提供的一个C#代码编译器,它将C#代码编译为C++代码,然后使用标准的C++编译器将C++代码编译为原生机器码。这种编译方式使得Unity游戏在iOS和WebGL平台上拥有更好的性能。但是,il2cpp的代码裁剪功能有时会移除一些方法调用,导致运行时无法找到某些类,尤其是当这些类是通过反射调用时。 在Unity项目中,link.xml文件用于防止il2cpp在编译过程中移除那些可能被反射调用的类或方法。为了正确使用link.xml,需要在文件中准确指定需要保留的类或方法的完整名称(fullname)。这里的 fullname是指类或方法的命名空间和名称组合,它是识别Unity项目中所有类和方法的唯一标识。 如果 fullname的定义不清晰,那么link.xml文件中的配置就可能无效,也就是说,il2cpp在进行代码裁剪时可能会移除那些本应保留的类或方法。这就需要开发者能够查看到确切的dll文件中的类的fullname,以便正确地配置link.xml文件。 在给定的压缩包文件列表中,有一个名为"json.cs"的文件,这个文件可能是一个C#源文件,它可能包含了用于获取dll中类的fullname的代码。开发者可以通过这个C#源文件来编写代码,调用API获取dll中的类的fullname信息。 为了解决fullname定义不清的问题,通常可以采取以下步骤: 1. 找到Unity项目的"Assets/Plugins"文件夹,这是存放平台特定的插件和dll文件的地方。 2. 使用Unity编辑器或文件系统找到需要的dll文件,将其放置到合适的目录。 3. 创建或修改link.xml文件,这个文件一般位于Unity项目的"Assets"目录下。 4. 在link.xml文件中配置需要保留的类或方法,格式大致如下: ```xml <linker> <assembly fullname="AssemblyName"> <type fullname="Namespace.ClassName" preserve="all"/> </assembly> </linker> ``` 5. 在"json.cs"等脚本中编写代码调用API,获取dll中类的fullname。 6. 将获取到的fullname填入link.xml文件的相应位置。 7. 重新构建Unity项目,以使配置生效。 需要注意的是,进行这些操作时,需要确保所使用的API和类库的版本与Unity项目的版本兼容,否则可能会出现其他问题。 总结来说,本文提供了如何通过查看dll的fullname来解决il2cpp编译坑问题的详细步骤,并且介绍了如何正确配置link.xml文件以防止il2cpp在编译过程中移除可能会被反射调用的类或方法。通过这些方法,可以有效避免在使用il2cpp时遇到的一些常见问题。

相关推荐

filetype
filetype

”PowerShell 7 环境已加载 (版本: 7.5.2) PowerShell 7 环境已加载 (版本: 7.5.2) PS C:\Users\Administrator\Desktop> cd E:\PyTorch_Build\pytorch PS E:\PyTorch_Build\pytorch> python -m venv rtx5070_env PS E:\PyTorch_Build\pytorch> .\rtx5070_env\Scripts\activate (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 允许执行策略 (rtx5070_env) PS E:\PyTorch_Build\pytorch> Set-ExecutionPolicy Bypass -Scope Process -Force (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 运行安装脚本 (rtx5070_env) PS E:\PyTorch_Build\pytorch> .\install_openblas_enhanced.ps1 🚀 开始 OpenBLAS 0.3.27 安装流程 (增强版)... ❌ 未找到 openblas.dll 🔍 目录内容诊断: 目标目录已存在: E:\Libs\OpenBLAS 尝试镜像站点: github.com 📥 下载: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.27/OpenBLAS-0.3.27-x64.zip“ ”PowerShell 7 环境已加载 (版本: 7.5.2) PS C:\Users\Administrator\Desktop> cd E:\PyTorch_Build\pytorch PS E:\PyTorch_Build\pytorch> python -m venv rtx5070_env PS E:\PyTorch_Build\pytorch> .\rtx5070_env\Scripts\activate (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 手动下载并安装 OpenBLAS (rtx5070_env) PS E:\PyTorch_Build\pytorch> $downloadUrl = "https://github.com/xianyi/OpenBLAS/releases/download/v0.3.27/OpenBLAS-0.3.27-x64.zip" (rtx5070_env) PS E:\PyTorch_Build\pytorch> $localZip = "E:\Downloads\OpenBLAS-0.3.27-x64.zip" (rtx5070_env) PS E:\PyTorch_Build\pytorch> $downloadDir = "E:\Libs\OpenBLAS" (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 下载文件 (rtx5070_env) PS E:\PyTorch_Build\pytorch> Invoke-WebRequest -Uri $downloadUrl -OutFile $localZip Invoke-WebRequest: One or more errors occurred. (The response ended prematurely. (ResponseEnded)) (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 使用 7-Zip 解压 (更可靠) (rtx5070_env) PS E:\PyTorch_Build\pytorch> if (Get-Command 7z -ErrorAction SilentlyContinue) { >> 7z x "$localZip" -o"$downloadDir" -y >> } (rtx5070_env) PS E:\PyTorch_Build\pytorch> else { >> # 使用系统解压 >> Expand-Archive -Path $localZip -DestinationPath $downloadDir -Force >> } else: The term 'else' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 验证目录结构 (rtx5070_env) PS E:\PyTorch_Build\pytorch> if (Test-Path "$downloadDir\bin\openblas.dll") { >> # 设置环境变量 >> [Environment]::SetEnvironmentVariable("OpenBLAS_HOME", $downloadDir, "Machine") >> Write-Host "✅ OpenBLAS 手动安装成功" -ForegroundColor Green >> } (rtx5070_env) PS E:\PyTorch_Build\pytorch> else { >> # 修复可能的路径问题 >> $actualDll = Get-ChildItem $downloadDir -Recurse -Filter openblas.dll | Select-Object -First 1 >> >> if ($actualDll) { >> $correctDir = $actualDll.Directory.Parent.FullName >> [Environment]::SetEnvironmentVariable("OpenBLAS_HOME", $correctDir, "Machine") >> Write-Host "⚠️ 文件路径调整到: $correctDir" -ForegroundColor Yellow >> } else { >> Write-Host "❌ 未找到 openblas.dll" -ForegroundColor Red >> } >> } else: The term 'else' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 验证命令 (rtx5070_env) PS E:\PyTorch_Build\pytorch> Get-FileHash -Path OpenBLAS-0.3.27-x64.zip -Algorithm SHA256 Get-FileHash: Cannot find path 'E:\PyTorch_Build\pytorch\OpenBLAS-0.3.27-x64.zip' because it does not exist. (rtx5070_env) PS E:\PyTorch_Build\pytorch>“

filetype

PS C:\Users\Administrator> # Fixed-ProjectCleanup.ps1 >> $projectRoot = "E:\ProjectEcosystem\ProjectMonitor" >> >> # 1. 创建标准文件夹结构 >> $folders = @( >> "SQLite", >> "Logs", >> "Database", >> "Scripts", >> "Config", >> "Binaries", >> "SourceFiles" >> ) >> >> foreach ($folder in $folders) { >> $path = Join-Path $projectRoot $folder >> if (-not (Test-Path $path)) { >> New-Item -ItemType Directory -Path $path -Force | Out-Null >> } >> } >> >> # 2. 修复的SQLite文件移动方法 >> $sqliteFiles = @( >> "System.Data.SQLite.*", >> "SQLite.Interop.dll", >> "sqlite3.*", >> "SQLite.NET.chm" >> ) >> >> foreach ($pattern in $sqliteFiles) { >> $files = Get-ChildItem -Path $projectRoot -Filter $pattern -File >> foreach ($file in $files) { >> $destDir = Join-Path $projectRoot "SQLite" >> $destPath = Join-Path $destDir $file.Name >> >> # 确保目标目录存在 >> if (-not (Test-Path $destDir)) { >> New-Item -ItemType Directory -Path $destDir -Force | Out-Null >> } >> >> Move-Item -Path $file.FullName -Destination $destPath -Force -ErrorAction SilentlyContinue >> if ($?) { >> Write-Host "✅ 已移动: $($file.Name) -> SQLite\" -ForegroundColor Cyan >> } >> } >> } >> >> # 3. 移动数据库文件 (修复路径问题) >> $dbFiles = Get-ChildItem -Path $projectRoot -Filter "*.db*" -File >> foreach ($db in $dbFiles) { >> $destDir = Join-Path $projectRoot "Database" >> $destPath = Join-Path $destDir $db.Name >> >> Move-Item -Path $db.FullName -Destination $destPath -Force >> Write-Host "✅ 已移动数据库: $($db.Name) -> Database\" -ForegroundColor Cyan >> } >> >> # 4. 移动脚本文件 (添加排除当前脚本) >> $scriptFiles = Get-ChildItem -Path $projectRoot -Filter "*.ps*1" -File | >> Where-Object { $_.Name -ne "Fixed-ProjectCleanup.ps1" } >> >> foreach ($script in $scriptFiles) { >> $destDir = Join-Path $projectRoot "Scripts" >> $destPath = Join-Path $destDir $script.Name >> >> Move-Item -Path $script.FullName -Destination $destPath -Force >> Write-Host "✅ 已移动脚本: $($script.Name) -> Scripts\" -ForegroundColor Cyan >> } >> >> # 5. 修复的配置文件移动方法 (排除目录) >> $configFiles = Get-ChildItem -Path $projectRoot -Filter "*config*" -File >> foreach ($config in $configFiles) { >> $destDir = Join-Path $projectRoot "Config" >> $destPath = Join-Path $destDir $config.Name >> >> Move-Item -Path $config.FullName -Destination $destPath -Force >> Write-Host "✅ 已移动配置: $($config.Name) -> Config\" -ForegroundColor Cyan >> } >> >> # 6. 新增移动可执行文件 >> $exeFiles = Get-ChildItem -Path $projectRoot -Filter "*.exe" -File >> foreach ($exe in $exeFiles) { >> $destDir = Join-Path $projectRoot "Binaries" >> $destPath = Join-Path $destDir $exe.Name >> >> Move-Item -Path $exe.FullName -Destination $destPath -Force >> Write-Host "✅ 已移动可执行文件: $($exe.Name) -> Binaries\" -ForegroundColor Cyan >> } >> >> # 7. 新增移动源代码文件 >> $sourceFiles = Get-ChildItem -Path $projectRoot -Filter "*.py" -File >> foreach ($source in $sourceFiles) { >> $destDir = Join-Path $projectRoot "SourceFiles" >> $destPath = Join-Path $destDir $source.Name >> >> Move-Item -Path $source.FullName -Destination $destPath -Force >> Write-Host "✅ 已移动源代码: $($source.Name) -> SourceFiles\" -ForegroundColor Cyan >> } >> >> # 8. 清理临时文件 (更安全的版本) >> $tempPatterns = @( >> "*.zip", >> "*.tmp", >> "*.bak", >> "Thumbs.db" >> ) >> >> foreach ($pattern in $tempPatterns) { >> Get-ChildItem -Path $projectRoot -Filter $pattern -File -ErrorAction SilentlyContinue | >> Remove-Item -Force -ErrorAction SilentlyContinue >> } >> >> # 9. 清理空文件夹 (排除标准目录) >> $excludeDirs = $folders | ForEach-Object { Join-Path $projectRoot $_ } >> Get-ChildItem -Path $projectRoot -Directory -Recurse | >> Where-Object { >> $_.FullName -notin $excludeDirs -and >> $_.GetFiles().Count -eq 0 -and >> $_.GetDirectories().Count -eq 0 >> } | >> Remove-Item -Force -Recurse >> >> # 10. 最终目录结构展示 >> Write-Host "✨ 清理完成!项目目录已整理 ✨" -ForegroundColor Green >> Write-Host "当前目录结构:" >> tree $projectRoot /F /A >> ✅ 已移动: System.Data.SQLite.dll -> SQLite\ ✅ 已移动: System.Data.SQLite.EF6.dll -> SQLite\ ✅ 已移动: System.Data.SQLite.EF6.pdb -> SQLite\ ✅ 已移动: System.Data.SQLite.EF6.xml -> SQLite\ ✅ 已移动: System.Data.SQLite.Linq.dll -> SQLite\ ✅ 已移动: System.Data.SQLite.Linq.pdb -> SQLite\ ✅ 已移动: System.Data.SQLite.Linq.xml -> SQLite\ ✅ 已移动: System.Data.SQLite.pdb -> SQLite\ ✅ 已移动: System.Data.SQLite.xml -> SQLite\ ✅ 已移动可执行文件: Installer.exe -> Binaries\ ✅ 已移动可执行文件: test.exe -> Binaries\ ✅ 已移动可执行文件: testef6.exe -> Binaries\ ✅ 已移动可执行文件: testlinq.exe -> Binaries\ ✅ 已移动源代码: db_init.py -> SourceFiles\ ✅ 已移动源代码: monitor.py -> SourceFiles\ ✅ 已移动源代码: state_analyzer.py -> SourceFiles\ ✨ 清理完成!项目目录已整理 ✨ 当前目录结构: 卷 ="模型响应", 的文件夹 PATH 列表 卷序列号为 7648-2CD3 E:\PROJECTECOSYSTEM\PROJECTMONITOR | Installer.pdb | SQLite.Designer.dll | SQLite.Designer.pdb | SQLite.Designer.xml | test.pdb | testef6.pdb | testlinq.pdb | +---APIServer | | .gitignore | | APIServer.code-workspace | | package.json | | | \---src | index.js | +---BackendService | | .gitignore | | BackendService.code-workspace | | BackendService.sln | | | \---src | \---BackendService | BackendService.csproj | Program.cs | +---Binaries | Installer.exe | test.exe | testef6.exe | testlinq.exe | +---Config | System.Data.SQLite.dll.config | test.exe.config | testef6.exe.config | testlinq.exe.config | +---DataAnalysis | | .gitignore | | DataAnalysis.code-workspace | | requirements.txt | | | \---src | main.py | +---Database | northwindEF.db | project_state.db | +---EcoMonitor | | .gitignore | | README.md | | | \---config | settings.psd1 | +---Logs +---MyApp | | .gitignore | | MyApp.code-workspace | | | \---src | index.html | main.js | style.css | +---MyWebApp | | .gitignore | | MyWebApp.code-workspace | | | \---src | index.html | main.js | style.css | +---Scripts | Initialize-DevEnv.psm1 | Monitor-Project.ps1 | Start-Ecosystem.ps1 | +---SourceFiles | db_init.py | monitor.py | state_analyzer.py | \---SQLite System.Data.SQLite.dll System.Data.SQLite.EF6.dll System.Data.SQLite.EF6.pdb System.Data.SQLite.EF6.xml System.Data.SQLite.Linq.dll System.Data.SQLite.Linq.pdb System.Data.SQLite.Linq.xml System.Data.SQLite.pdb System.Data.SQLite.xml PS C:\Users\Administrator> Set-Content -Path "E:\ProjectEcosystem\.gitignore" @" >> # 忽略临时文件 >> *.tmp >> *.bak >> Thumbs.db >> >> # 忽略编译输出 >> Binaries/ >> Logs/ >> >> # 忽略数据库文件 >> Database/*.db >> Database/*.db-shm >> Database/*.db-wal >> >> # 忽略个人配置文件 >> Config/personal.* >> "@ >> PS C:\Users\Administrator> # 创建项目工作空间配置文件 >> $workspaceConfig = @{ >> "folders" = @( >> @{ "path" = "SQLite" }, >> @{ "path" = "Database" }, >> @{ "path" = "Scripts" }, >> @{ "path" = "Config" }, >> @{ "path" = "Logs" }, >> @{ "path" = "Binaries" }, >> @{ "path" = "SourceFiles" } >> ) >> "settings" = @{ >> "files.exclude" = @{ >> "**/*.tmp": true, >> "**/*.bak": true, >> "**/Thumbs.db": true >> } >> } >> } >> >> ConvertTo-Json $workspaceConfig -Depth 3 | >> Set-Content -Path "E:\ProjectEcosystem\ProjectMonitor.code-workspace"

filetype

WARNING: Enabling and disabling experimental features do not take effect until next start of PowerShell. WARNING: Enabling and disabling experimental features do not take effect until next start of PowerShell. [PS7 19:25:05] C:\Users\Administrator\Desktop [master] > # 增强版 Install-Socat 函数(修复下载源问题) [PS7 19:25:13] C:\Users\Administrator\Desktop [master] > function Install-Socat { >> param( >> [Parameter(Mandatory = $false)] >> [string]$InstallDrive = "E:", >> >> [Parameter(Mandatory = $false)] >> [string]$InstallDir = "Program Files\Socat" >> ) >> >> # 1. 规范化路径处理 >> $fullPath = [System.IO.Path]::GetFullPath("$InstallDrive\$InstallDir").TrimEnd('\') >> >> # 2. 验证文件系统权限 >> if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { >> Write-Warning "需要管理员权限安装程序" >> return $null >> } >> >> # 3. 检查现有安装 >> $existingPath = (Get-Command socat -ErrorAction SilentlyContinue | >> Select-Object -ExpandProperty Source -First 1) ?? $null >> >> if ($existingPath) { >> Write-Host "已安装于: $existingPath" -ForegroundColor Green >> return $existingPath >> } >> >> # 4. 创建安装目录 >> try { >> if (-not (Test-Path $fullPath)) { >> $null = New-Item -Path $fullPath -ItemType Directory -Force >> } >> } catch { >> Write-Error "创建目录失败: $($_.Exception.Message)" >> return $null >> } >> >> # 5. 文件下载(更新有效的下载源) >> $tempFile = Join-Path $env:TEMP "socat-win64.zip" >> $downloadUrls = @( >> # 官方镜像源 >> "https://github.com/portapps/socat-portable/releases/download/1.7.4.4/socat-1.7.4.4-win64.zip", >> "https://downloads.sourceforge.net/project/unix-utils/socat/1.7.4.4/socat-1.7.4.4-win64.zip?ts=$(Get-Date -UFormat %s)", >> >> # 备用镜像源 >> "https://github.com/portapps/socat-portable/releases/download/1.7.4.4/socat-1.7.4.4-win64.zip", >> "https://cfhcable.dl.sourceforge.net/project/unix-utils/socat/1.7.4.4/socat-1.7.4.4-win64.zip", >> "https://altushost-swe.dl.sourceforge.net/project/unix-utils/socat/1.7.4.4/socat-1.7.4.4-win64.zip" >> ) >> >> $validDownload = $false >> $lastError = $null >> >> foreach ($downloadUrl in $downloadUrls) { >> try { >> # 清除旧下载 >> if (Test-Path $tempFile) { >> Remove-Item $tempFile -Force -ErrorAction SilentlyContinue >> } >> >> # 下载文件 >> Write-Host "尝试从 $downloadUrl 下载..." -ForegroundColor Cyan >> $ProgressPreference = 'SilentlyContinue' >> >> try { >> Invoke-WebRequest $downloadUrl -OutFile $tempFile -UseBasicParsing -RetryIntervalSec 3 -ErrorAction Stop >> } catch { >> $lastError = $_.Exception.Message >> Write-Warning "下载失败 ($downloadUrl): $lastError" >> continue >> } >> >> # 验证文件大小(最小1MB) >> $fileInfo = Get-Item $tempFile -ErrorAction Stop >> if ($fileInfo.Length -lt 1MB) { >> $lastError = "文件过小 ($([math]::Round($fileInfo.Length/1KB)) KB)" >> Write-Warning "文件校验失败: $lastError" >> continue >> } >> >> # 验证ZIP文件完整性 >> try { >> Add-Type -AssemblyName System.IO.Compression.FileSystem -ErrorAction Stop >> $archive = [System.IO.Compression.ZipFile]::OpenRead($tempFile) >> $entryCount = $archive.Entries.Count >> $archive.Dispose() >> >> if ($entryCount -eq 0) { >> $lastError = "空压缩包" >> Write-Warning "文件校验失败: $lastError" >> continue >> } >> >> $validDownload = $true >> Write-Host "成功下载并验证: $downloadUrl" -ForegroundColor Green >> break >> } catch { >> $lastError = $_.Exception.Message >> Write-Warning "文件校验失败: $lastError" >> } >> } catch { >> $lastError = $_.Exception.Message >> Write-Warning "下载过程中出错: $lastError" >> } finally { >> $ProgressPreference = 'Continue' >> } >> } >> >> if (-not $validDownload) { >> Write-Error "所有下载源均失败。最后错误: $lastError" >> Write-Host @" >> 无法自动下载socat。请手动执行以下操作: >> 1. 从以下链接下载socat: >> https://github.com/portapps/socat-portable/releases >> 2. 解压到: $fullPath >> 3. 将以下路径添加到系统PATH环境变量: >> $fullPath >> "@ -ForegroundColor Yellow >> return $null >> } >> >> # 6. 解压缩 >> try { >> # 确保目标目录存在 >> if (-not (Test-Path $fullPath)) { >> $null = New-Item -Path $fullPath -ItemType Directory -Force >> } >> >> # 使用.NET方法解压 >> Add-Type -AssemblyName System.IO.Compression.FileSystem >> [System.IO.Compression.ZipFile]::ExtractToDirectory($tempFile, $fullPath) >> >> $socatExe = Join-Path $fullPath "socat.exe" >> >> if (-not (Test-Path $socatExe -PathType Leaf)) { >> throw "解压后未找到 socat.exe" >> } >> } catch { >> Write-Error "解压失败: $($_.Exception.Message)" >> return $null >> } >> >> # 7. 环境变量更新 >> $currentPath = [Environment]::GetEnvironmentVariable("Path", "Machine") >> if ($currentPath -notlike "*$fullPath*") { >> $newPath = $currentPath + ";$fullPath" >> [Environment]::SetEnvironmentVariable("Path", $newPath, "Machine") >> } >> >> # 8. 更新当前会话PATH >> $env:Path += ";$fullPath" >> >> # 9. 返回完整路径 >> if (Test-Path $socatExe) { >> Write-Host "socat 安装成功: $socatExe" -ForegroundColor Green >> return $socatExe.ToString() >> } else { >> Write-Error "安装后文件验证失败" >> return $null >> } >> } [PS7 19:25:14] C:\Users\Administrator\Desktop [master] > [PS7 19:25:14] C:\Users\Administrator\Desktop [master] > # 增强版 New-TcpTunnel 函数(保持不变) [PS7 19:25:14] C:\Users\Administrator\Desktop [master] > function New-TcpTunnel { >> param( >> [int]$LocalPort = 8443, >> [string]$RemoteHost = "google.com", >> [int]$RemotePort = 443, >> [string]$SocatPath = $null >> ) >> >> # 1. 获取socat路径 >> $socatBinary = if ($SocatPath -and (Test-Path $SocatPath)) { >> $SocatPath.ToString() >> } else { >> $installedPath = Install-Socat >> if (-not $installedPath) { >> throw "socat安装失败" >> } >> $installedPath.ToString() >> } >> >> # 2. 创建日志文件 >> $logTime = Get-Date -Format "yyyyMMdd-HHmmss" >> $stdOutFile = Join-Path $env:TEMP "socat-$LocalPort-$logTime-out.log" >> $stdErrFile = Join-Path $env:TEMP "socat-$LocalPort-$logTime-err.log" >> >> # 3. 启动进程 >> try { >> $processArgs = @{ >> FilePath = $socatBinary >> ArgumentList = "TCP-LISTEN:$LocalPort,fork,reuseaddr TCP:$($RemoteHost):$RemotePort" >> NoNewWindow = $true >> RedirectStandardOutput = $stdOutFile >> RedirectStandardError = $stdErrFile >> PassThru = $true >> } >> >> $process = Start-Process @processArgs >> } catch { >> Write-Error "启动socat失败: $($_.Exception.Message)" >> if (Test-Path $stdErrFile) { >> Write-Warning "错误日志内容: $(Get-Content $stdErrFile -Raw)" >> } >> throw >> } >> >> # 4. 验证端口监听 >> $portActive = $false >> 1..5 | ForEach-Object { >> Start-Sleep -Seconds 1 >> if (-not $portActive) { >> $portStatus = Get-NetTCPConnection -LocalPort $LocalPort -ErrorAction SilentlyContinue >> $portActive = [bool]$portStatus >> } >> } >> >> if (-not $portActive) { >> Write-Warning "端口 $LocalPort 状态: 未监听" >> if (Test-Path $stdErrFile) { >> Write-Warning "错误日志: $(Get-Content $stdErrFile -Raw)" >> } >> throw "隧道创建失败,端口 $LocalPort 未监听" >> } >> >> # 5. 返回进程信息 >> return [PSCustomObject]@{ >> Process = $process >> Port = $LocalPort >> StdOutLog = $stdOutFile >> StdErrLog = $stdErrFile >> } >> } [PS7 19:25:14] C:\Users\Administrator\Desktop [master] > # 测试安装函数 [PS7 19:25:20] C:\Users\Administrator\Desktop [master] > $socatPath = Install-Socat -Verbose 尝试从 https://github.com/portapps/socat-portable/releases/download/1.7.4.4/socat-1.7.4.4-win64.zip 下载... VERBOSE: Requested HTTP/1.1 GET with 0-byte payload VERBOSE: Received HTTP/1.1 9-byte response of content type text/plain WARNING: 下载失败 (https://github.com/portapps/socat-portable/releases/download/1.7.4.4/socat-1.7.4.4-win64.zip): Response status code does not indicate success: 404 (Not Found). 尝试从 https://downloads.sourceforge.net/project/unix-utils/socat/1.7.4.4/socat-1.7.4.4-win64.zip?ts=1757157921 下载... VERBOSE: Requested HTTP/1.1 GET with 0-byte payload VERBOSE: Received HTTP/1.1 response of content type text/html of unknown size VERBOSE: File Name: socat-win64.zip WARNING: 文件校验失败: 文件过小 (102 KB) 尝试从 https://github.com/portapps/socat-portable/releases/download/1.7.4.4/socat-1.7.4.4-win64.zip 下载... VERBOSE: Requested HTTP/1.1 GET with 0-byte payload VERBOSE: Received HTTP/1.1 9-byte response of content type text/plain WARNING: 下载失败 (https://github.com/portapps/socat-portable/releases/download/1.7.4.4/socat-1.7.4.4-win64.zip): Response status code does not indicate success: 404 (Not Found). 尝试从 https://cfhcable.dl.sourceforge.net/project/unix-utils/socat/1.7.4.4/socat-1.7.4.4-win64.zip 下载... VERBOSE: Requested HTTP/1.1 GET with 0-byte payload WARNING: 下载失败 (https://cfhcable.dl.sourceforge.net/project/unix-utils/socat/1.7.4.4/socat-1.7.4.4-win64.zip): 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。 (cfhcable.dl.sourceforge.net:443) 尝试从 https://altushost-swe.dl.sourceforge.net/project/unix-utils/socat/1.7.4.4/socat-1.7.4.4-win64.zip 下载... VERBOSE: Requested HTTP/1.1 GET with 0-byte payload VERBOSE: Received HTTP/1.1 response of content type text/html of unknown size VERBOSE: File Name: socat-win64.zip WARNING: 文件校验失败: 文件过小 (102 KB) Install-Socat: 所有下载源均失败。最后错误: 文件过小 (102 KB) 无法自动下载socat。请手动执行以下操作: 1. 从以下链接下载socat: https://github.com/portapps/socat-portable/releases 2. 解压到: E:\Program Files\Socat 3. 将以下路径添加到系统PATH环境变量: E:\Program Files\Socat [PS7 19:25:58] C:\Users\Administrator\Desktop [master] > [PS7 19:25:58] C:\Users\Administrator\Desktop [master] > # 验证安装 [PS7 19:25:58] C:\Users\Administrator\Desktop [master] > if ($socatPath) { >> socat -V >> Write-Host "socat 安装成功" -ForegroundColor Green >> } [PS7 19:25:58] C:\Users\Administrator\Desktop [master] > # 创建到HTTP服务的隧道 [PS7 19:26:10] C:\Users\Administrator\Desktop [master] > $tunnel = New-TcpTunnel -LocalPort 8080 -RemoteHost "example.com" -RemotePort 80 尝试从 https://github.com/portapps/socat-portable/releases/download/1.7.4.4/socat-1.7.4.4-win64.zip 下载... WARNING: 下载失败 (https://github.com/portapps/socat-portable/releases/download/1.7.4.4/socat-1.7.4.4-win64.zip): Response status code does not indicate success: 404 (Not Found). 尝试从 https://downloads.sourceforge.net/project/unix-utils/socat/1.7.4.4/socat-1.7.4.4-win64.zip?ts=1757157971 下载... WARNING: 文件校验失败: 文件过小 (102 KB) 尝试从 https://github.com/portapps/socat-portable/releases/download/1.7.4.4/socat-1.7.4.4-win64.zip 下载... WARNING: 下载失败 (https://github.com/portapps/socat-portable/releases/download/1.7.4.4/socat-1.7.4.4-win64.zip): Response status code does not indicate success: 404 (Not Found). 尝试从 https://cfhcable.dl.sourceforge.net/project/unix-utils/socat/1.7.4.4/socat-1.7.4.4-win64.zip 下载... WARNING: 下载失败 (https://cfhcable.dl.sourceforge.net/project/unix-utils/socat/1.7.4.4/socat-1.7.4.4-win64.zip): 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。 (cfhcable.dl.sourceforge.net:443) 尝试从 https://altushost-swe.dl.sourceforge.net/project/unix-utils/socat/1.7.4.4/socat-1.7.4.4-win64.zip 下载... WARNING: 文件校验失败: 文件过小 (102 KB) Install-Socat: Line | 13 | $installedPath = Install-Socat | ~~~~~~~~~~~~~ | 所有下载源均失败。最后错误: 文件过小 (102 KB) 无法自动下载socat。请手动执行以下操作: 1. 从以下链接下载socat: https://github.com/portapps/socat-portable/releases 2. 解压到: E:\Program Files\Socat 3. 将以下路径添加到系统PATH环境变量: E:\Program Files\Socat Exception: Line | 15 | throw "socat安装失败" | ~~~~~~~~~~~~~~~~~ | socat安装失败 [PS7 19:26:48] C:\Users\Administrator\Desktop [master] > [PS7 19:26:48] C:\Users\Administrator\Desktop [master] > # 测试隧道 [PS7 19:26:48] C:\Users\Administrator\Desktop [master] > Start-Process "http://localhost:$($tunnel.Port)" [PS7 19:26:48] C:\Users\Administrator\Desktop [master] > [PS7 19:26:48] C:\Users\Administrator\Desktop [master] > # 监控日志 [PS7 19:26:48] C:\Users\Administrator\Desktop [master] > Get-Content $tunnel.StdErrLog -Wait -Tail 10 Get-Content: Cannot bind argument to parameter 'Path' because it is null. [PS7 19:26:48] C:\Users\Administrator\Desktop [master] > $cacheFile = "C:\ProgramData\socat-cache\socat-win64.zip" [PS7 19:27:07] C:\Users\Administrator\Desktop [master] > if (Test-Path $cacheFile) { >> Copy-Item $cacheFile $tempFile >> $validDownload = $true >> } [PS7 19:27:07] C:\Users\Administrator\Desktop [master] >

filetype

Python搜索路径: - - E:\PyTorch_Build\pytorch - E:\Python310\python310.zip - E:\Python310\DLLs - E:\Python310\lib - E:\Python310 - E:\PyTorch_Build\pytorch\build\.venv - E:\PyTorch_Build\pytorch\build\.venv\lib\site-packages (.venv) PS E:\PyTorch_Build\pytorch\build> # 定位 torch._C 模块路径 (.venv) PS E:\PyTorch_Build\pytorch\build> $torchDir = python -c "import os; print(os.path.dirname(__import__('torch').__file__))" Traceback (most recent call last): File "<string>", line 1, in <module> File "E:\PyTorch_Build\pytorch\torch\__init__.py", line 423, in <module> from torch._C import * # noqa: F403 ImportError: DLL load failed while importing _C: 找不到指定的模块。 (.venv) PS E:\PyTorch_Build\pytorch\build> $cModulePath = Join-Path $torchDir "_C*.pyd" Join-Path: Cannot bind argument to parameter 'Path' because it is null. (.venv) PS E:\PyTorch_Build\pytorch\build> (.venv) PS E:\PyTorch_Build\pytorch\build> # 检查文件是否存在 (.venv) PS E:\PyTorch_Build\pytorch\build> if (-not (Test-Path $cModulePath)) { >> Write-Host "未找到 _C 模块,尝试从构建目录复制..." >> $buildDir = "E:\PyTorch_Build\pytorch\build\lib.win-amd64-cpython-310\torch" >> Copy-Item -Path "$buildDir\_C*.pyd" -Destination $torchDir -Force >> } InvalidOperation: The variable '$cModulePath' cannot be retrieved because it has not been set. (.venv) PS E:\PyTorch_Build\pytorch\build> (.venv) PS E:\PyTorch_Build\pytorch\build> # 使用 dumpbin 检查依赖项 (.venv) PS E:\PyTorch_Build\pytorch\build> $vcBinPath = "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\dumpbin.exe" (.venv) PS E:\PyTorch_Build\pytorch\build> if (Test-Path $vcBinPath) { >> $cModule = Get-Item $cModulePath >> & $vcBinPath /dependents $cModule.FullName | Out-Host >> } else { >> Write-Host "Visual Studio工具未找到,跳过依赖分析" >> } InvalidOperation: Line | 2 | $cModule = Get-Item $cModulePath | ~~~~~~~~~~~~ | The variable '$cModulePath' cannot be retrieved because it has not been set. InvalidOperation: Line | 3 | & $vcBinPath /dependents $cModule.FullName | Out-Host | ~~~~~~~~ | The variable '$cModule' cannot be retrieved because it has not been set. (.venv) PS E:\PyTorch_Build\pytorch\build> # 确保所有必需的 CUDA DLL 都在 PATH 中 (.venv) PS E:\PyTorch_Build\pytorch\build> $cudaDlls = @("cudart64_110.dll", "cublas64_11.dll", "cufft64_10.dll", >> "curand64_10.dll", "cusolver64_11.dll", "cudnn64_8.dll") (.venv) PS E:\PyTorch_Build\pytorch\build> (.venv) PS E:\PyTorch_Build\pytorch\build> foreach ($dll in $cudaDlls) { >> $sourcePath = "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin\$dll" >> if (Test-Path $sourcePath) { >> Copy-Item -Path $sourcePath -Destination $torchDir -Force >> Write-Host "已复制: $dll" >> } else { >> Write-Host "未找到: $dll" >> } >> } 未找到: cudart64_110.dll 未找到: cublas64_11.dll 未找到: cufft64_10.dll 未找到: curand64_10.dll 未找到: cusolver64_11.dll 未找到: cudnn64_8.dll (.venv) PS E:\PyTorch_Build\pytorch\build> (.venv) PS E:\PyTorch_Build\pytorch\build> # 添加 OpenBLAS 依赖 (.venv) PS E:\PyTorch_Build\pytorch\build> $openblasPath = "E:\OpenBLAS\bin\*.dll" (.venv) PS E:\PyTorch_Build\pytorch\build> if (Test-Path $openblasPath) { >> Copy-Item -Path $openblasPath -Destination $torchDir -Force >> Write-Host "已复制OpenBLAS依赖" >> } (.venv) PS E:\PyTorch_Build\pytorch\build> # 创建环境配置脚本 (.venv) PS E:\PyTorch_Build\pytorch\build> Set-Content -Path setup_env.ps1 -Value @' >> $env:PATH = "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin;$env:PATH" >> $env:PATH = "E:\OpenBLAS\bin;$env:PATH" >> $env:PATH = "E:\PyTorch_Build\pytorch\build\lib;$env:PATH" >> $env:PYTHONPATH = "E:\PyTorch_Build\pytorch" >> '@ (.venv) PS E:\PyTorch_Build\pytorch\build> (.venv) PS E:\PyTorch_Build\pytorch\build> # 执行环境配置 (.venv) PS E:\PyTorch_Build\pytorch\build> . .\setup_env.ps1 (.venv) PS E:\PyTorch_Build\pytorch\build> python -c @" >> import os >> import sys >> import ctypes >> import traceback >> >> def check_dll(dll_name): >> try: >> ctypes.CDLL(dll_name) >> print(f"[成功] DLL加载: {dll_name}") >> except OSError as e: >> print(f"[失败] DLL加载: {dll_name} - {str(e)}") >> >> try: >> # 检查关键DLL >> print("--- 关键DLL检查 ---") >> check_dll("cudart64_110.dll") >> check_dll("cublas64_11.dll") >> check_dll("torch_python.dll") >> >> # 尝试导入torch >> print("\n--- 导入Torch ---") >> import torch >> print(f"PyTorch版本: {torch.__version__}") >> print(f"CUDA可用: {torch.cuda.is_available()}") >> >> if torch.cuda.is_available(): >> print(f"GPU设备: {torch.cuda.get_device_name(0)}") >> a = torch.ones(2, 2).cuda() >> b = torch.ones(2, 2).cuda() >> c = a * b >> print(f"简单计算验证: {c.sum().item()}") >> >> # 验证核心功能 >> print("\n--- 核心功能验证 ---") >> print(f"张量创建: {torch.tensor([1, 2, 3])}") >> print(f"CUDA设备数量: {torch.cuda.device_count()}") >> >> except Exception as e: >> print(f"\n--- 错误详情 ---") >> traceback.print_exc() >> print(f"\n系统PATH: {os.getenv('PATH')}") >> print(f"Python路径: {sys.path}") >> "@ --- 关键DLL检查 --- [失败] DLL加载: cudart64_110.dll - Could not find module 'cudart64_110.dll' (or one of its dependencies). Try using the full path with constructor syntax. [失败] DLL加载: cublas64_11.dll - Could not find module 'cublas64_11.dll' (or one of its dependencies). Try using the full path with constructor syntax. [失败] DLL加载: torch_python.dll - Could not find module 'torch_python.dll' (or one of its dependencies). Try using the full path with constructor syntax. --- 导入Torch --- --- 错误详情 --- Traceback (most recent call last): File "<string>", line 22, in <module> File "E:\PyTorch_Build\pytorch\torch\__init__.py", line 423, in <module> from torch._C import * # noqa: F403 ImportError: DLL load failed while importing _C: 找不到指定的模块。 系统PATH: E:\PyTorch_Build\pytorch\build\lib;E:\OpenBLAS\bin;E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin;E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin;E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin;E:\PyTorch_Build\pytorch\build\.venv\Scripts;E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin;C:\Program Files\PowerShell\7;E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin\x64;E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin;E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin\x64;;E:\PyTorch_Build\pytorch\build\lib.win-amd64-cpython-310\torch\lib;E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin;E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin;C:\Users\Administrator\AppData\Local\Microsoft\dotnet;C:\Users\Administrator\AppData\Local\Microsoft\dotnet;C:\Users\Administrator\AppData\Local\Microsoft\dotnet\;C:\Program Files\dotnet;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;E:\Python310;C:\Program Files\dotnet\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\.dotnet\tools;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\.dotnet\tools;E:\Python310\Scripts;E:\Python310\Scripts;C:\Program Files\PowerShell\7\;E:\Program Files\Microsoft VS Code\bin;E:\Program Files\Git\cmd;C:\Program Files\NVIDIA Corporation\Nsight Compute 2025.3.0\;E:\Program Files\CMake\bin;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files (x86)\Incredibuild;E:\PyTorch_Build\pytorch\build\lib.win-amd64-cpython-310\torch\lib;E:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\ProgramData\chocolatey\bin;E:\Program Files\Rust\.cargo\bin;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\.dotnet\tools Python路径: ['', 'E:\\PyTorch_Build\\pytorch', 'E:\\Python310\\python310.zip', 'E:\\Python310\\DLLs', 'E:\\Python310\\lib', 'E:\\Python310', 'E:\\PyTorch_Build\\pytorch\\build\\.venv', 'E:\\PyTorch_Build\\pytorch\\build\\.venv\\lib\\site-packages'] (.venv) PS E:\PyTorch_Build\pytorch\build>

filetype

PowerShell 7 环境已加载 (版本: 7.5.2) PowerShell 7 环境已加载 (版本: 7.5.2) PS C:\Users\Administrator\Desktop> <# >> 终极版 Libuv 部署脚本 - 自动版本检测 + 多源下载 >> #> PS C:\Users\Administrator\Desktop> param([switch]$SkipDownload) PS C:\Users\Administrator\Desktop> PS C:\Users\Administrator\Desktop> # === 初始化设置 === PS C:\Users\Administrator\Desktop> $ErrorActionPreference = 'Stop' PS C:\Users\Administrator\Desktop> Set-StrictMode -Version 3 PS C:\Users\Administrator\Desktop> Start-Transcript -Path "$env:TEMP\libuv_install.log" -Append Transcript started, output file is C:\Users\ADMINI~1\AppData\Local\Temp\libuv_install.log PS C:\Users\Administrator\Desktop> PS C:\Users\Administrator\Desktop> function Assert-Admin { >> $currentUser = [Security.Principal.WindowsIdentity]::GetCurrent() >> $adminRole = [Security.Principal.WindowsBuiltInRole]::Administrator >> if (-not ([Security.Principal.WindowsPrincipal] $currentUser).IsInRole($adminRole)) { >> throw "请使用管理员权限运行此脚本" >> } >> } PS C:\Users\Administrator\Desktop> Assert-Admin PS C:\Users\Administrator\Desktop> PS C:\Users\Administrator\Desktop> try { >> $workingDir = "E:\PyTorch_Build\pytorch" >> if (-not (Test-Path $workingDir)) { >> New-Item -ItemType Directory -Path $workingDir -Force | Out-Null >> } >> Set-Location -Path $workingDir >> >> # 1. 自动获取最新版本号 >> Write-Host "获取 Libuv 最新版本信息..." -ForegroundColor Cyan >> try { >> $releaseInfo = Invoke-RestMethod -Uri "https://api.github.com/repos/libuv/libuv/releases/latest" -UseBasicParsing >> $libuvVersion = $releaseInfo.tag_name -replace '^v' >> Write-Host "检测到最新版本: v$libuvVersion" -ForegroundColor Green >> } >> catch { >> Write-Host "⚠️ 无法获取最新版本,使用默认版本 1.49.0" -ForegroundColor Yellow >> $libuvVersion = "1.49.0" >> } >> >> # 2. 多源下载链接 >> $downloadSources = @( >> "https://github.com/libuv/libuv/releases/download/v$libuvVersion/libuv-v$libuvVersion-win-x64.zip", >> "https://dist.libuv.org/dist/v$libuvVersion/libuv-v$libuvVersion-win-x64.zip", >> "https://ghproxy.com/https://github.com/libuv/libuv/releases/download/v$libuvVersion/libuv-v$libuvVersion-win-x64.zip" >> ) >> >> $localZip = "libuv_temp_$($libuvVersion.Replace('.','_')).zip" >> $downloadSuccess = $false >> >> if (-not $SkipDownload) { >> Write-Host "尝试从多个源下载 Libuv v$libuvVersion..." -ForegroundColor Cyan >> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 >> >> foreach ($source in $downloadSources) { >> try { >> Write-Host "尝试下载源: $source" -ForegroundColor Cyan >> >> # 使用更可靠的下载方法 >> if ($PSVersionTable.PSVersion.Major -ge 7) { >> # PowerShell 7+ 使用新的下载方法 >> Invoke-WebRequest -Uri $source -OutFile $localZip -SkipCertificateCheck >> } >> else { >> # 兼容旧版 PowerShell >> $webClient = New-Object System.Net.WebClient >> $webClient.DownloadFile($source, $localZip) >> $webClient.Dispose() >> } >> >> if ((Test-Path $localZip) -and (Get-Item $localZip).Length -gt 1MB) { >> $downloadSuccess = $true >> Write-Host "✅ 下载成功!" -ForegroundColor Green >> break >> } >> } >> catch { >> Write-Host "❌ 下载失败: $($_.Exception.Message)" -ForegroundColor Red >> Remove-Item $localZip -Force -ErrorAction SilentlyContinue >> } >> } >> >> if (-not $downloadSuccess) { >> throw "所有下载源均失败。请手动下载并保存为: $localZip" >> } >> } >> >> # 3. 创建目录结构 >> Write-Host "创建 Libuv 目录..." -ForegroundColor Cyan >> $libuvDest = Join-Path $workingDir "third_party\libuv" >> $dirs = @('bin', 'include', 'lib') >> $dirs | ForEach-Object { >> $path = Join-Path $libuvDest $_ >> New-Item -Path $path -ItemType Directory -Force -ErrorAction SilentlyContinue | Out-Null >> } >> >> # 4. 解压文件 >> Write-Host "解压文件..." -ForegroundColor Cyan >> $tempDir = Join-Path $env:TEMP "libuv_temp_$(Get-Date -Format 'yyyyMMddHHmmss')" >> New-Item -ItemType Directory -Path $tempDir -Force | Out-Null >> >> Expand-Archive -Path $localZip -DestinationPath $tempDir -Force >> >> # 更灵活的文件查找 >> $extractedDir = Get-ChildItem $tempDir -Directory -Recurse -Filter "libuv-*" | >> Select-Object -First 1 >> >> if (-not $extractedDir) { >> # 尝试其他可能的目录名 >> $extractedDir = Get-ChildItem $tempDir -Directory -Recurse | >> Where-Object { $_.Name -match 'uv|libuv' } | >> Select-Object -First 1 >> >> if (-not $extractedDir) { >> throw "无法找到解压后的Libuv目录。解压路径: $tempDir" >> } >> } >> >> # 5. 复制文件 >> Write-Host "复制文件到目标位置..." -ForegroundColor Cyan >> $sourceBase = $extractedDir.FullName >> >> # 使用更通用的文件查找 >> $copyOperations = @( >> @{ Source = "$sourceBase\bin\*.dll"; Dest = "$libuvDest\bin" } >> @{ Source = "$sourceBase\include\*"; Dest = "$libuvDest\include"; Recurse = $true } >> @{ Source = "$sourceBase\lib\*.lib"; Dest = "$libuvDest\lib" } >> ) >> >> foreach ($op in $copyOperations) { >> if ($op.Recurse) { >> Copy-Item -Path $op.Source -Destination $op.Dest -Recurse -Force >> } >> else { >> Copy-Item -Path $op.Source -Destination $op.Dest -Force >> } >> } >> >> # 6. 创建CMake配置文件 >> Write-Host "配置CMake..." -ForegroundColor Cyan >> $cmakeModulesDir = Join-Path $workingDir "cmake\Modules" >> New-Item -Path $cmakeModulesDir -ItemType Directory -Force -ErrorAction SilentlyContinue | Out-Null >> >> # 查找所有可能的库文件 >> $libFiles = Get-ChildItem "$libuvDest\lib" -Filter "uv*.lib" -Recurse >> if (-not $libFiles) { >> throw "未找到Libuv库文件" >> } >> >> $relativePath = $libuvDest.Replace($workingDir, "").TrimStart('\').Replace('\', '/') >> >> # 动态生成包含所有库文件的配置 >> $libLibraries = $libFiles | ForEach-Object { >> " `"\${CMAKE_CURRENT_SOURCE_DIR}/$relativePath/lib/$($_.Name)`"" >> } -join "`n" >> >> $libuvConfig = @" >> # Libuv手动配置 >> set(LIBUV_FOUND ON) >> set(LIBUV_INCLUDE_DIRS "\${CMAKE_CURRENT_SOURCE_DIR}/$relativePath/include") >> set(LIBUV_LIBRARIES >> $libLibraries >> ) >> "@ >> >> $configPath = Join-Path $cmakeModulesDir "FindLibuv.cmake" >> Set-Content -Path $configPath -Value $libuvConfig -Encoding UTF8 >> >> # 7. 验证安装 >> $requiredFiles = @( >> "$libuvDest\include\uv.h", >> $libFiles[0].FullName, >> "$configPath" >> ) >> >> $missingFiles = $requiredFiles | Where-Object { -not (Test-Path $_) } >> if ($missingFiles) { >> throw "安装不完整,缺少文件: $($missingFiles -join ', ')" >> } >> >> Write-Host "`n✅ Libuv v$libuvVersion 安装成功!" -ForegroundColor Green >> Write-Host "CMake配置文件位置: $configPath" -ForegroundColor Cyan >> Write-Host "Libuv库文件: $($libFiles.Count) 个" -ForegroundColor Cyan >> } >> catch { >> Write-Host "`n❌ 安装失败: $_" -ForegroundColor Red >> Write-Host "错误详细信息: $($_.Exception.Message)" -ForegroundColor Yellow >> Write-Host "错误位置: $($_.InvocationInfo.ScriptName):$($_.InvocationInfo.ScriptLineNumber)" -ForegroundColor Yellow >> Write-Host "请查看完整日志: $env:TEMP\libuv_install.log" -ForegroundColor Yellow >> } 获取 Libuv 最新版本信息... ⚠️ 无法获取最新版本,使用默认版本 1.49.0 尝试从多个源下载 Libuv v1.49.0... 尝试下载源: https://github.com/libuv/libuv/releases/download/v1.49.0/libuv-v1.49.0-win-x64.zip ❌ 下载失败: Response status code does not indicate success: 404 (Not Found). 尝试下载源: https://dist.libuv.org/dist/v1.49.0/libuv-v1.49.0-win-x64.zip ❌ 下载失败: Response status code does not indicate success: 404 (Not Found). 尝试下载源: https://ghproxy.com/https://github.com/libuv/libuv/releases/download/v1.49.0/libuv-v1.49.0-win-x64.zip ❌ 下载失败: The SSL connection could not be established, see inner exception. ❌ 安装失败: 所有下载源均失败。请手动下载并保存为: libuv_temp_1_49_0.zip 错误详细信息: 所有下载源均失败。请手动下载并保存为: libuv_temp_1_49_0.zip 错误位置: :63 请查看完整日志: C:\Users\ADMINI~1\AppData\Local\Temp\libuv_install.log PS E:\PyTorch_Build\pytorch> finally { >> if (Test-Path $tempDir) { >> Remove-Item $tempDir -Recurse -Force -ErrorAction SilentlyContinue >> } >> if (Test-Path $localZip) { >> Remove-Item $localZip -Force -ErrorAction SilentlyContinue >> } >> >> Write-Host "`n按任意键退出..." -NoNewline >> $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") >> Stop-Transcript >> } finally: The term 'finally' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. PS E:\PyTorch_Build\pytorch> 我看不懂那个界面 我下载了一个“libuv-1.51.0.tar.gz”这是你需要的吗

filetype

PowerShell 7 环境已加载 (版本: 7.5.2) PowerShell 7 环境已加载 (版本: 7.5.2) PS C:\Users\Administrator\Desktop> cd E:\PyTorch_Build\pytorch PS E:\PyTorch_Build\pytorch> python -m venv rtx5070_env PS E:\PyTorch_Build\pytorch> .\rtx5070_env\Scripts\activate (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 允许执行策略 (rtx5070_env) PS E:\PyTorch_Build\pytorch> Set-ExecutionPolicy RemoteSigned -Scope Process -Force (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 运行安装脚本 (rtx5070_env) PS E:\PyTorch_Build\pytorch> .\install_openblas_ps7.ps1 🚀 开始 OpenBLAS 0.3.27 安装流程 (PowerShell 7兼容版)... ❌ 未找到 openblas.dll 目标目录已存在: E:\Libs\OpenBLAS 尝试镜像站点: excellmedia.dl.sourceforge.net 下载: https://excellmedia.dl.sourceforge.net/project/openblas/v0.3.27/OpenBLAS-0.3.27-x64.zip ✅ 下载完成: 0.12 MB 解压到: E:\Libs\OpenBLAS GAC Version Location --- ------- -------- False v4.0.30319 C:\Program Files\PowerShell\7\WindowsBase.dll ❌ 安装失败: 📥 手动安装指南: 1. 手动下载 OpenBLAS: 访问: https://sourceforge.net/projects/openblas/files/v0.3.27/OpenBLAS-0.3.27-x64.zip 2. 解压到目录: E:\Libs\OpenBLAS 3. 设置环境变量 (管理员权限): [Environment]::SetEnvironmentVariable('OpenBLAS_HOME', 'E:\Libs\OpenBLAS', 'Machine') 4. 验证安装: Test-Path "E:\Libs\OpenBLAS\bin\openblas.dll" ✅ 安装过程完成 (rtx5070_env) PS E:\PyTorch_Build\pytorch>

filetype

PS C:\Users\Administrator> # ProjectCleanup.ps1 >> $projectRoot = "E:\ProjectEcosystem\ProjectMonitor" >> >> # 1. 创建标准文件夹结构 >> $folders = @( >> "SQLite", >> "Logs", >> "Database", >> "Scripts", >> "Config" >> ) >> >> foreach ($folder in $folders) { >> $path = Join-Path $projectRoot $folder >> if (-not (Test-Path $path)) { >> New-Item -ItemType Directory -Path $path -Force | Out-Null >> } >> } >> >> # 2. 识别并移动SQLite文件 >> $sqliteFiles = @( >> "System.Data.SQLite.dll", >> "System.Data.SQLite.Linq.dll", >> "SQLite.Interop.dll", >> "sqlite3.def", >> "sqlite3.dll", >> "SQLite.NET.chm" >> ) >> >> foreach ($file in $sqliteFiles) { >> $source = Join-Path $projectRoot $file >> $dest = Join-Path $projectRoot "SQLite" $file >> >> if (Test-Path $source) { >> Move-Item -Path $source -Destination $dest -Force >> Write-Host "✅ 已移动: $file -> SQLite\" -ForegroundColor Cyan >> } >> } >> >> # 3. 移动数据库文件 >> $dbFiles = Get-ChildItem -Path $projectRoot -Filter "*.db*" >> foreach ($db in $dbFiles) { >> Move-Item -Path $db.FullName -Destination (Join-Path $projectRoot "Database") -Force >> Write-Host "✅ 已移动数据库: $($db.Name) -> Database\" -ForegroundColor Cyan >> } >> >> # 4. 移动脚本文件 >> $scriptFiles = Get-ChildItem -Path $projectRoot -Filter "*.ps*1" >> foreach ($script in $scriptFiles) { >> Move-Item -Path $script.FullName -Destination (Join-Path $projectRoot "Scripts") -Force >> Write-Host "✅ 已移动脚本: $($script.Name) -> Scripts\" -ForegroundColor Cyan >> } >> >> # 5. 移动配置文件 >> $configFiles = Get-ChildItem -Path $projectRoot -Filter "*config*" >> foreach ($config in $configFiles) { >> Move-Item -Path $config.FullName -Destination (Join-Path $projectRoot "Config") -Force >> Write-Host "✅ 已移动配置: $($config.Name) -> Config\" -ForegroundColor Cyan >> } >> >> # 6. 清理临时文件 >> $tempFiles = @( >> "*.zip", >> "*.tmp", >> "*.log", >> "*.bak", >> "Thumbs.db" >> ) >> >> foreach ($pattern in $tempFiles) { >> Get-ChildItem -Path $projectRoot -Filter $pattern | Remove-Item -Force >> } >> >> # 7. 清理空文件夹 >> Get-ChildItem -Path $projectRoot -Directory -Recurse | >> Where-Object { $_.GetFiles().Count -eq 0 -and $_.GetDirectories().Count -eq 0 } | >> Remove-Item -Force -Recurse >> >> Write-Host "✨ 清理完成!项目目录已整理 ✨" -ForegroundColor Green >> Write-Host "当前目录结构:" >> tree $projectRoot /F /A >> Join-Path : 找不到接受实际参数“System.Data.SQLite.dll”的位置形式参数。 所在位置 行:32 字符: 13 + $dest = Join-Path $projectRoot "SQLite" $file + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Join-Path],ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.JoinPathCommand Move-Item : 无法处理参数,因为参数“destination”的值为空。请将参数“destination”的值更改为非空值。 所在位置 行:35 字符: 9 + Move-Item -Path $source -Destination $dest -Force + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Move-Item],PSArgumentNullException + FullyQualifiedErrorId : ArgumentNull,Microsoft.PowerShell.Commands.MoveItemCommand ✅ 已移动: System.Data.SQLite.dll -> SQLite\ Join-Path : 找不到接受实际参数“System.Data.SQLite.Linq.dll”的位置形式参数。 所在位置 行:32 字符: 13 + $dest = Join-Path $projectRoot "SQLite" $file + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Join-Path],ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.JoinPathCommand Move-Item : 无法处理参数,因为参数“destination”的值为空。请将参数“destination”的值更改为非空值。 所在位置 行:35 字符: 9 + Move-Item -Path $source -Destination $dest -Force + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Move-Item],PSArgumentNullException + FullyQualifiedErrorId : ArgumentNull,Microsoft.PowerShell.Commands.MoveItemCommand ✅ 已移动: System.Data.SQLite.Linq.dll -> SQLite\ Join-Path : 找不到接受实际参数“SQLite.Interop.dll”的位置形式参数。 所在位置 行:32 字符: 13 + $dest = Join-Path $projectRoot "SQLite" $file + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Join-Path],ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.JoinPathCommand Join-Path : 找不到接受实际参数“sqlite3.def”的位置形式参数。 所在位置 行:32 字符: 13 + $dest = Join-Path $projectRoot "SQLite" $file + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Join-Path],ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.JoinPathCommand Join-Path : 找不到接受实际参数“sqlite3.dll”的位置形式参数。 所在位置 行:32 字符: 13 + $dest = Join-Path $projectRoot "SQLite" $file + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Join-Path],ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.JoinPathCommand Join-Path : 找不到接受实际参数“SQLite.NET.chm”的位置形式参数。 所在位置 行:32 字符: 13 + $dest = Join-Path $projectRoot "SQLite" $file + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Join-Path],ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.JoinPathCommand ✅ 已移动数据库: northwindEF.db -> Database\ ✅ 已移动数据库: project_state.db -> Database\ ✅ 已移动脚本: Initialize-DevEnv.psm1 -> Scripts\ ✅ 已移动脚本: Monitor-Project.ps1 -> Scripts\ ✅ 已移动脚本: Start-Ecosystem.ps1 -> Scripts\ Move-Item : 参数错误。 所在位置 行:57 字符: 5 + Move-Item -Path $config.FullName -Destination (Join-Path $project ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (E:\ProjectEcosy...tMonitor\Config:DirectoryInfo) [Move-Item], IOException + FullyQualifiedErrorId : MoveDirectoryItemIOError,Microsoft.PowerShell.Commands.MoveItemCommand ✅ 已移动配置: Config -> Config\ ✅ 已移动配置: System.Data.SQLite.dll.config -> Config\ ✅ 已移动配置: test.exe.config -> Config\ ✅ 已移动配置: testef6.exe.config -> Config\ ✅ 已移动配置: testlinq.exe.config -> Config\ ✨ 清理完成!项目目录已整理 ✨ 当前目录结构: 卷 ="模型响应", 的文件夹 PATH 列表 卷序列号为 7648-2CD3 E:\PROJECTECOSYSTEM\PROJECTMONITOR | db_init.py | Installer.exe | Installer.pdb | monitor.py | SQLite.Designer.dll | SQLite.Designer.pdb | SQLite.Designer.xml | state_analyzer.py | System.Data.SQLite.dll | System.Data.SQLite.EF6.dll | System.Data.SQLite.EF6.pdb | System.Data.SQLite.EF6.xml | System.Data.SQLite.Linq.dll | System.Data.SQLite.Linq.pdb | System.Data.SQLite.Linq.xml | System.Data.SQLite.pdb | System.Data.SQLite.xml | test.exe | test.pdb | testef6.exe | testef6.pdb | testlinq.exe | testlinq.pdb | +---APIServer | | .gitignore | | APIServer.code-workspace | | package.json | | | \---src | index.js | +---BackendService | | .gitignore | | BackendService.code-workspace | | BackendService.sln | | | \---src | \---BackendService | BackendService.csproj | Program.cs | +---Config | System.Data.SQLite.dll.config | test.exe.config | testef6.exe.config | testlinq.exe.config | +---DataAnalysis | | .gitignore | | DataAnalysis.code-workspace | | requirements.txt | | | \---src | main.py | +---Database | northwindEF.db | project_state.db | +---EcoMonitor | | .gitignore | | README.md | | | \---config | settings.psd1 | +---MyApp | | .gitignore | | MyApp.code-workspace | | | \---src | index.html | main.js | style.css | +---MyWebApp | | .gitignore | | MyWebApp.code-workspace | | | \---src | index.html | main.js | style.css | \---Scripts Initialize-DevEnv.psm1 Monitor-Project.ps1 Start-Ecosystem.ps1 PS C:\Users\Administrator>

filetype

PS C:\Users\Administrator> # Ultimate-ProjectCleanup.ps1 >> $projectRoot = "E:\ProjectEcosystem\ProjectMonitor" >> >> # 1. 创建完整的文件夹结构 >> $folders = @( >> "SQLite", >> "Logs", >> "Database", >> "Scripts", >> "Config", >> "Binaries", >> "SourceFiles", >> "Documentation", >> "Libraries", >> "BuildOutputs" >> ) >> >> foreach ($folder in $folders) { >> $path = Join-Path $projectRoot $folder >> if (-not (Test-Path $path)) { >> New-Item -ItemType Directory -Path $path -Force | Out-Null >> } >> } >> >> # 2. 增强的SQLite文件移动(包含PDB和XML) >> $sqlitePatterns = @( >> "System.Data.SQLite.*", >> "SQLite.Interop.*", >> "sqlite3.*", >> "SQLite.NET.*" >> ) >> >> foreach ($pattern in $sqlitePatterns) { >> $files = Get-ChildItem -Path $projectRoot -Filter $pattern -File >> foreach ($file in $files) { >> $destDir = Join-Path $projectRoot "SQLite" >> $destPath = Join-Path $destDir $file.Name >> >> if (-not (Test-Path $destDir)) { >> New-Item -ItemType Directory -Path $destDir -Force | Out-Null >> } >> >> Move-Item -Path $file.FullName -Destination $destPath -Force -ErrorAction SilentlyContinue >> if ($?) { >> Write-Host "✅ 已移动SQLite文件: $($file.Name) -> SQLite\" -ForegroundColor Cyan >> } >> } >> } >> >> # 3. 移动所有程序数据库文件(PDB)到BuildOutputs >> $pdbFiles = Get-ChildItem -Path $projectRoot -Filter "*.pdb" -File >> foreach ($pdb in $pdbFiles) { >> $destDir = Join-Path $projectRoot "BuildOutputs" >> $destPath = Join-Path $destDir $pdb.Name >> >> Move-Item -Path $pdb.FullName -Destination $destPath -Force >> Write-Host "✅ 已移动PDB文件: $($pdb.Name) -> BuildOutputs\" -ForegroundColor Cyan >> } >> >> # 4. 移动所有XML文档文件到Documentation >> $xmlFiles = Get-ChildItem -Path $projectRoot -Filter "*.xml" -File >> foreach ($xml in $xmlFiles) { >> $destDir = Join-Path $projectRoot "Documentation" >> $destPath = Join-Path $destDir $xml.Name >> >> Move-Item -Path $xml.FullName -Destination $destPath -Force >> Write-Host "✅ 已移动文档: $($xml.Name) -> Documentation\" -ForegroundColor Cyan >> } >> >> # 5. 移动其他库文件到Libraries >> $libraryPatterns = @("*.dll", "*.lib", "*.a") >> foreach ($pattern in $libraryPatterns) { >> $files = Get-ChildItem -Path $projectRoot -Filter $pattern -File >> foreach ($file in $files) { >> # 排除已处理的SQLite文件 >> if ($file.FullName -notlike "*\SQLite\*") { >> $destDir = Join-Path $projectRoot "Libraries" >> $destPath = Join-Path $destDir $file.Name >> >> Move-Item -Path $file.FullName -Destination $destPath -Force >> Write-Host "✅ 已移动库文件: $($file.Name) -> Libraries\" -ForegroundColor Cyan >> } >> } >> } >> >> # 6. 项目感知型清理 - 保留项目结构 >> $projectFolders = @("APIServer", "BackendService", "DataAnalysis", "EcoMonitor", "MyApp", "MyWebApp") >> foreach ($project in $projectFolders) { >> $projectPath = Join-Path $projectRoot $project >> if (Test-Path $projectPath) { >> Write-Host "🔍 清理项目: $project" -ForegroundColor Yellow >> >> # 清理项目中的临时文件 >> $tempPatterns = @("*.tmp", "*.bak", "Thumbs.db") >> foreach ($pattern in $tempPatterns) { >> Get-ChildItem -Path $projectPath -Filter $pattern -File -Recurse -ErrorAction SilentlyContinue | >> Remove-Item -Force -ErrorAction SilentlyContinue >> } >> >> # 清理项目中的空文件夹 >> Get-ChildItem -Path $projectPath -Directory -Recurse | >> Where-Object { >> $_.GetFiles().Count -eq 0 -and >> $_.GetDirectories().Count -eq 0 >> } | >> Remove-Item -Force -Recurse -ErrorAction SilentlyContinue >> } >> } >> >> # 7. 生成目录结构报告 >> $structureReport = Join-Path $projectRoot "Project_Structure_Report.txt" >> tree $projectRoot /F /A | Out-File -FilePath $structureReport -Encoding UTF8 >> >> # 8. 最终结果展示 >> Write-Host "✨ 终极清理完成!项目目录完美整理 ✨" -ForegroundColor Green >> Write-Host "当前目录结构:" >> tree $projectRoot /F /A >> Write-Host "完整报告已保存至: $structureReport" -ForegroundColor Yellow >> ✅ 已移动PDB文件: Installer.pdb -> BuildOutputs\ ✅ 已移动PDB文件: SQLite.Designer.pdb -> BuildOutputs\ ✅ 已移动PDB文件: test.pdb -> BuildOutputs\ ✅ 已移动PDB文件: testef6.pdb -> BuildOutputs\ ✅ 已移动PDB文件: testlinq.pdb -> BuildOutputs\ ✅ 已移动文档: SQLite.Designer.xml -> Documentation\ ✅ 已移动库文件: SQLite.Designer.dll -> Libraries\ 🔍 清理项目: APIServer 🔍 清理项目: BackendService 🔍 清理项目: DataAnalysis 🔍 清理项目: EcoMonitor 🔍 清理项目: MyApp 🔍 清理项目: MyWebApp ✨ 终极清理完成!项目目录完美整理 ✨ 当前目录结构: 卷 ="模型响应", 的文件夹 PATH 列表 卷序列号为 7648-2CD3 E:\PROJECTECOSYSTEM\PROJECTMONITOR | Project_Structure_Report.txt | +---APIServer | | .gitignore | | APIServer.code-workspace | | package.json | | | \---src | index.js | +---BackendService | | .gitignore | | BackendService.code-workspace | | BackendService.sln | | | \---src | \---BackendService | BackendService.csproj | Program.cs | +---Binaries | Installer.exe | test.exe | testef6.exe | testlinq.exe | +---BuildOutputs | Installer.pdb | SQLite.Designer.pdb | test.pdb | testef6.pdb | testlinq.pdb | +---Config | System.Data.SQLite.dll.config | test.exe.config | testef6.exe.config | testlinq.exe.config | +---DataAnalysis | | .gitignore | | DataAnalysis.code-workspace | | requirements.txt | | | \---src | main.py | +---Database | northwindEF.db | project_state.db | +---Documentation | SQLite.Designer.xml | +---EcoMonitor | | .gitignore | | README.md | | | \---config | settings.psd1 | +---Libraries | SQLite.Designer.dll | +---Logs +---MyApp | | .gitignore | | MyApp.code-workspace | | | \---src | index.html | main.js | style.css | +---MyWebApp | | .gitignore | | MyWebApp.code-workspace | | | \---src | index.html | main.js | style.css | +---Scripts | Initialize-DevEnv.psm1 | Monitor-Project.ps1 | Start-Ecosystem.ps1 | +---SourceFiles | db_init.py | monitor.py | state_analyzer.py | \---SQLite System.Data.SQLite.dll System.Data.SQLite.EF6.dll System.Data.SQLite.EF6.pdb System.Data.SQLite.EF6.xml System.Data.SQLite.Linq.dll System.Data.SQLite.Linq.pdb System.Data.SQLite.Linq.xml System.Data.SQLite.pdb System.Data.SQLite.xml 完整报告已保存至: E:\ProjectEcosystem\ProjectMonitor\Project_Structure_Report.txt PS C:\Users\Administrator> # 处理PDB文件 >> Get-ChildItem -Path $projectRoot -Filter "*.pdb" -File | >> Move-Item -Destination "$projectRoot\BuildOutputs" >> >> # 处理XML文档 >> Get-ChildItem -Path $projectRoot -Filter "*.xml" -File | >> Move-Item -Destination "$projectRoot\Documentation" >> PS C:\Users\Administrator> # 只清理项目目录中的临时文件,保留项目结构 >> $projectFolders | ForEach-Object { >> Get-ChildItem -Path (Join-Path $projectRoot $_) -Filter "*.tmp" -Recurse | >> Remove-Item -Force >> } >> PS C:\Users\Administrator> # 创建目录结构报告 >> tree $projectRoot /F /A | Out-File "Project_Structure_Report.txt" >> PS C:\Users\Administrator> # Permanent-ProjectOrganizer.ps1 >> $organizerScript = @" >> # 自动维护脚本 - 每天运行 >> `$projectRoot = "E:\ProjectEcosystem\ProjectMonitor" >> >> # 1. 清理临时文件 >> Get-ChildItem -Path `$projectRoot -Include *.tmp, *.bak, Thumbs.db -Recurse | >> Remove-Item -Force -ErrorAction SilentlyContinue >> >> # 2. 自动分类新文件 >> `$watcher = @{ >> "*.ps*1" = "Scripts" >> "*.exe" = "Binaries" >> "*.dll" = "Libraries" >> "*.pdb" = "BuildOutputs" >> "*.xml" = "Documentation" >> "*.db" = "Database" >> "*.py" = "SourceFiles" >> "*.json" = "Config" >> } >> >> Get-ChildItem -Path `$projectRoot -File | ForEach-Object { >> foreach (`$rule in `$watcher.GetEnumerator()) { >> if (`$_.Name -like `$rule.Key) { >> `$targetDir = Join-Path `$projectRoot `$rule.Value >> if (-not (Test-Path `$targetDir)) { >> New-Item -ItemType Directory -Path `$targetDir | Out-Null >> } >> Move-Item -Path `$_.FullName -Destination `$targetDir -Force >> break >> } >> } >> } >> >> # 3. 每周生成报告 >> if ((Get-Date).DayOfWeek -eq [System.DayOfWeek]::Monday) { >> tree `$projectRoot /F /A | Out-File (Join-Path `$projectRoot "Weekly_Structure_Report.txt") >> } >> "@ >> >> Set-Content -Path "E:\ProjectEcosystem\ProjectOrganizer.ps1" -Value $organizerScript >> PS C:\Users\Administrator> # 创建Windows计划任务 >> $action = New-ScheduledTaskAction -Execute "PowerShell.exe" ` >> -Argument "-ExecutionPolicy Bypass -File `"E:\ProjectEcosystem\ProjectOrganizer.ps1`"" >> >> $trigger = New-ScheduledTaskTrigger -Daily -At 3am >> >> Register-ScheduledTask -Action $action -Trigger $trigger ` >> -TaskName "ProjectMonitor_Organizer" -Description "每日自动整理项目目录" ` >> -User "SYSTEM" -RunLevel Highest >> TaskPath TaskName State -------- -------- ----- \ ProjectMonitor_Organizer Ready PS C:\Users\Administrator>

filetype

“v1.49.0:2024.09.25,版本 1.49.0(稳定版 比较 santigimeno 发布时间 Sep 25,2024 ·174 个提交到 v1x 自此版本以来1.49.0版 囟-0- d2e56a5 有关详细信息,请参阅 #4468: https://dist.ibuv.org/dist/v1.49.0/处的 Dist 文件 显着变化 linux:默认禁用 SQPOLL io_uring #4492 ·UNIX:恢复 preadv/pwritev 回退代码 #4345 ·win,fs:使用新的 Windows 快速统计 API #4327 修复了重要错误 win,pipe:修复并发读取器的竞争 #4470. ·win,signal:修复数据争用调度 SIGWINCH #4488 资产24 源代码(邮政编码) 用 源代码(tar.gz) Sep 25,2024 Sep 25, 2024” “PowerShell 7 环境已加载 (版本: 7.5.2) PowerShell 7 环境已加载 (版本: 7.5.2) PS C:\Users\Administrator\Desktop> <# >> 增强版 Libuv 部署脚本 - 修复下载问题 >> #> PS C:\Users\Administrator\Desktop> param([switch]$SkipDownload) PS C:\Users\Administrator\Desktop> PS C:\Users\Administrator\Desktop> # === 初始化设置 === PS C:\Users\Administrator\Desktop> $ErrorActionPreference = 'Stop' PS C:\Users\Administrator\Desktop> Set-StrictMode -Version 3 PS C:\Users\Administrator\Desktop> Start-Transcript -Path "$env:TEMP\libuv_install.log" -Append Transcript started, output file is C:\Users\ADMINI~1\AppData\Local\Temp\libuv_install.log PS C:\Users\Administrator\Desktop> PS C:\Users\Administrator\Desktop> # 检查管理员权限 PS C:\Users\Administrator\Desktop> function Assert-Admin { >> $currentUser = [Security.Principal.WindowsIdentity]::GetCurrent() >> $adminRole = [Security.Principal.WindowsBuiltInRole]::Administrator >> if (-not ([Security.Principal.WindowsPrincipal] $currentUser).IsInRole($adminRole)) { >> throw "请使用管理员权限运行此脚本" >> } >> } PS C:\Users\Administrator\Desktop> Assert-Admin PS C:\Users\Administrator\Desktop> PS C:\Users\Administrator\Desktop> # === 主脚本 === PS C:\Users\Administrator\Desktop> try { >> # 自定义工作目录(根据实际修改) >> $workingDir = "E:\PyTorch_Build\pytorch" >> if (-not (Test-Path $workingDir)) { >> New-Item -ItemType Directory -Path $workingDir -Force | Out-Null >> } >> Set-Location -Path $workingDir >> >> # 1. 使用最新的 Libuv 版本和正确的下载链接 >> $libuvVersion = "1.49.0" # 更新到最新稳定版 >> $libuvBaseUrl = "https://github.com/libuv/libuv/releases/download/v$libuvVersion/" >> >> # 动态构建正确的文件名(官方命名规则已变) >> $libuvFileName = "libuv-v$libuvVersion-win64-msvc" # 实际的文件名前缀 >> $libuvUrl = "${libuvBaseUrl}${libuvFileName}.zip" >> $localZip = "libuv_temp_$($libuvVersion.Replace('.','_')).zip" >> >> if (-not $SkipDownload) { >> Write-Host "下载 Libuv $libuvVersion..." -ForegroundColor Cyan >> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 >> >> # 添加下载重试机制 >> $maxRetries = 3 >> for ($i = 1; $i -le $maxRetries; $i++) { >> try { >> Write-Host "尝试 #$i 下载: $libuvUrl" >> $webClient = New-Object System.Net.WebClient >> $webClient.DownloadFile($libuvUrl, $localZip) >> $webClient.Dispose() >> >> # 验证文件完整性 >> if ((Get-Item $localZip).Length -lt 1MB) { >> throw "文件大小异常,可能下载不完整" >> } >> break # 成功则跳出循环 >> } >> catch { >> if ($i -eq $maxRetries) { >> throw "下载失败: $_" >> } >> Write-Host "下载失败,10秒后重试..." -ForegroundColor Yellow >> Start-Sleep -Seconds 10 >> } >> } >> } >> >> # 2. 验证下载 >> if (-not (Test-Path $localZip)) { >> throw "Libuv 压缩包未找到。请手动下载: $libuvUrl" >> } >> >> # 3. 创建目录结构 >> Write-Host "创建 Libuv 目录..." -ForegroundColor Cyan >> $libuvDest = Join-Path $workingDir "third_party\libuv" >> $dirs = @('bin', 'include', 'lib') >> $dirs | ForEach-Object { >> $path = Join-Path $libuvDest $_ >> New-Item -Path $path -ItemType Directory -Force -ErrorAction SilentlyContinue | Out-Null >> } >> >> # 4. 解压文件 >> Write-Host "解压文件..." -ForegroundColor Cyan >> $tempDir = Join-Path $env:TEMP "libuv_temp_$(Get-Date -Format 'yyyyMMddHHmmss')" >> New-Item -ItemType Directory -Path $tempDir -Force | Out-Null >> >> Expand-Archive -Path $localZip -DestinationPath $tempDir -Force >> >> # 动态查找解压目录(匹配新文件名模式) >> $extractedDir = Get-ChildItem $tempDir -Directory -Filter "libuv-*" | >> Select-Object -First 1 >> >> if (-not $extractedDir) { >> throw "无法找到解压后的Libuv目录" >> } >> >> # 5. 复制文件 >> Write-Host "复制文件到目标位置..." -ForegroundColor Cyan >> $sourceBase = $extractedDir.FullName >> >> # 动态查找实际文件位置 >> $binItems = Get-ChildItem -Path "$sourceBase\bin" -File -Recurse -Filter "*.dll" >> if ($binItems) { >> $binItems | Copy-Item -Destination "$libuvDest\bin" -Force >> } >> >> $includeItems = Get-ChildItem -Path "$sourceBase\include" -File -Recurse >> if ($includeItems) { >> $includeItems | Copy-Item -Destination "$libuvDest\include" -Force >> } >> >> $libItems = Get-ChildItem -Path "$sourceBase\lib" -File -Recurse -Filter "*.lib" >> if ($libItems) { >> $libItems | Copy-Item -Destination "$libuvDest\lib" -Force >> } >> >> # 6. 创建CMake配置文件 >> Write-Host "配置CMake..." -ForegroundColor Cyan >> $cmakeModulesDir = Join-Path $workingDir "cmake\Modules" >> New-Item -Path $cmakeModulesDir -ItemType Directory -Force -ErrorAction SilentlyContinue | Out-Null >> >> # 获取实际的.lib文件名 >> $actualLibName = (Get-ChildItem "$libuvDest\lib" -Filter "uv*.lib" | >> Select-Object -First 1).Name >> >> if (-not $actualLibName) { >> throw "未找到Libuv库文件" >> } >> >> $relativePath = $libuvDest.Replace($workingDir, "").TrimStart('\').Replace('\', '/') >> $libuvConfig = @" >> # Libuv手动配置 >> set(LIBUV_FOUND ON) >> set(LIBUV_INCLUDE_DIRS "\${CMAKE_CURRENT_SOURCE_DIR}/$relativePath/include") >> set(LIBUV_LIBRARIES >> "\${CMAKE_CURRENT_SOURCE_DIR}/$relativePath/lib/$actualLibName" >> ) >> "@ >> >> $configPath = Join-Path $cmakeModulesDir "FindLibuv.cmake" >> Set-Content -Path $configPath -Value $libuvConfig -Encoding UTF8 >> >> # 7. 验证安装 >> $requiredFiles = @( >> "$libuvDest\include\uv.h", >> "$libuvDest\lib\$actualLibName", >> "$configPath" >> ) >> >> $missingFiles = $requiredFiles | Where-Object { -not (Test-Path $_) } >> if ($missingFiles) { >> throw "安装不完整,缺少文件: $($missingFiles -join ', ')" >> } >> >> Write-Host "`n✅ Libuv $libuvVersion 安装成功!" -ForegroundColor Green >> Write-Host "CMake配置文件位置: $configPath" -ForegroundColor Cyan >> } >> catch { >> Write-Host "`n❌ 安装失败: $_" -ForegroundColor Red >> Write-Host "错误详细信息: $($_.Exception.Message)" -ForegroundColor Yellow >> Write-Host "错误位置: $($_.InvocationInfo.ScriptName):$($_.InvocationInfo.ScriptLineNumber)" -ForegroundColor Yellow >> } 下载 Libuv 1.49.0... 尝试 #1 下载: https://github.com/libuv/libuv/releases/download/v1.49.0/libuv-v1.49.0-win64-msvc.zip 下载失败,10秒后重试... 尝试 #2 下载: https://github.com/libuv/libuv/releases/download/v1.49.0/libuv-v1.49.0-win64-msvc.zip 下载失败,10秒后重试... 尝试 #3 下载: https://github.com/libuv/libuv/releases/download/v1.49.0/libuv-v1.49.0-win64-msvc.zip ❌ 安装失败: 下载失败: Exception calling "DownloadFile" with "2" argument(s): "The remote server returned an error: (404) Not Found." 错误详细信息: 下载失败: Exception calling "DownloadFile" with "2" argument(s): "The remote server returned an error: (404) Not Found." 错误位置: :39 PS E:\PyTorch_Build\pytorch> finally { >> # 清理临时文件 >> if (Test-Path $tempDir) { >> Remove-Item $tempDir -Recurse -Force -ErrorAction SilentlyContinue >> } >> if (Test-Path $localZip) { >> Remove-Item $localZip -Force -ErrorAction SilentlyContinue >> } >> >> # 保持窗口打开 >> Write-Host "`n按任意键退出..." -NoNewline >> $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") >> Stop-Transcript >> } finally: The term 'finally' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. PS E:\PyTorch_Build\pytorch>”

luxiaoda
  • 粉丝: 0
上传资源 快速赚钱

最新资源