1.E:\Program Files\NVIDIA\CUNND\v9.12里面有bin
cudnn samples
include
lib
LICENSE,里面还有子文件12.9和13.0,mdll都在bin,h再include,E:\Program Files\NVIDIA\CUNND\v9.12\lib\13.0\x64里面是lib,12.9同样
2.Set-PythonEnv: C:\Users\Administrator\Documents\PowerShell\Microsoft.PowerShell_profile.ps1:5
Line |
5 | Set-PythonEnv -EnvName global
| ~~~~~~~~~~~~~
| The term 'Set-PythonEnv' 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.
Set-PythonEnv: C:\Users\Administrator\Documents\PowerShell\Microsoft.PowerShell_profile.ps1:5
Line |
5 | Set-PythonEnv -EnvName global
| ~~~~~~~~~~~~~
| The term 'Set-PythonEnv' 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 C:\Users\Administrator\Desktop> cd E:\PyTorch_Build\pytorch
PS E:\PyTorch_Build\pytorch> python -m venv rtx5070_env
Error: [Errno 13] Permission denied: 'E:\\PyTorch_Build\\pytorch\\rtx5070_env\\Scripts\\python.exe'
PS E:\PyTorch_Build\pytorch> .\rtx5070_env\Scripts\activate
(rtx5070_env) PS E:\PyTorch_Build\pytorch> # 路径验证脚本 (validate_paths.ps1)
(rtx5070_env) PS E:\PyTorch_Build\pytorch> $tools = @{
>> "Python" = "E:\Python310\python.exe"
>> "Git" = "E:\Program Files\Git\bin\git.exe"
>> "CUDA" = "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\"
>> "cuDNN" = "E:\Program Files\NVIDIA\cuDNN\v9.12\"
>> "OpenBLAS_Prebuilt" = "E:\Libs\OpenBLAS_Prebuilt\lib\openblas.lib"
>> "CMake" = "E:\Program Files\CMake\bin\cmake.exe"
>> "Ninja" = "E:\PyTorch_Build\pytorch\rtx5070_env\Scripts\ninja.exe"
>> }
(rtx5070_env) PS E:\PyTorch_Build\pytorch>
(rtx5070_env) PS E:\PyTorch_Build\pytorch> foreach ($tool in $tools.GetEnumerator()) {
>> $exists = Test-Path $tool.Value -ErrorAction SilentlyContinue
>> $status = if ($exists) { "✅ 验证通过" } else { "❌ 路径不存在" }
>> Write-Host ("{0,-20} {1,-60} {2}" -f $tool.Key, $tool.Value, $status)
>> }
cuDNN E:\Program Files\NVIDIA\cuDNN\v9.12\ ❌ 路径不存在
OpenBLAS_Prebuilt E:\Libs\OpenBLAS_Prebuilt\lib\openblas.lib ✅ 验证通过
Git E:\Program Files\Git\bin\git.exe ✅ 验证通过
CUDA E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\ ✅ 验证通过
Ninja E:\PyTorch_Build\pytorch\rtx5070_env\Scripts\ninja.exe ✅ 验证通过
CMake E:\Program Files\CMake\bin\cmake.exe ✅ 验证通过
Python E:\Python310\python.exe ✅ 验证通过
(rtx5070_env) PS E:\PyTorch_Build\pytorch>
(rtx5070_env) PS E:\PyTorch_Build\pytorch> # 特殊验证:OpenBLAS库文件
(rtx5070_env) PS E:\PyTorch_Build\pytorch> if (Test-Path $tools["OpenBLAS_Prebuilt"]) {
>> Write-Host "OpenBLAS库验证通过: $($tools['OpenBLAS_Prebuilt'])" -ForegroundColor Green
>> } else {
>> Write-Host "错误:OpenBLAS库文件未找到" -ForegroundColor Red
>> # 自动搜索备用路径
>> $found = Get-ChildItem "E:\Libs\" -Recurse -Filter "openblas.lib" | Select-Object -First 1
>> if ($found) {
>> Write-Host "发现备用路径: $($found.FullName)" -ForegroundColor Yellow
>> $env:OpenBLAS_HOME = $found.Directory.Parent.FullName
>> }
>> }
OpenBLAS库验证通过: E:\Libs\OpenBLAS_Prebuilt\lib\openblas.lib
(rtx5070_env) PS E:\PyTorch_Build\pytorch> # 修复PowerShell配置文件 (fix_profile.ps1)
(rtx5070_env) PS E:\PyTorch_Build\pytorch> $profilePath = "C:\Users\Administrator\Documents\PowerShell\Microsoft.PowerShell_profile.ps1"
(rtx5070_env) PS E:\PyTorch_Build\pytorch>
(rtx5070_env) PS E:\PyTorch_Build\pytorch> # 备份原始配置文件
(rtx5070_env) PS E:\PyTorch_Build\pytorch> $backupPath = "$profilePath.backup_$(Get-Date -Format 'yyyyMMdd')"
(rtx5070_env) PS E:\PyTorch_Build\pytorch> Copy-Item $profilePath $backupPath -Force
(rtx5070_env) PS E:\PyTorch_Build\pytorch>
(rtx5070_env) PS E:\PyTorch_Build\pytorch> # 修正配置文件内容
(rtx5070_env) PS E:\PyTorch_Build\pytorch> (Get-Content $profilePath) | ForEach-Object {
>> # 修复Set-PythonEnv调用问题
>> if ($_ -match "Set-PythonEnv -EnvName global") {
>> '# ' + $_ + " # 已禁用此问题命令"
>> }
>> # 添加模块自动加载
>> elseif ($_ -match "Export-ModuleMember") {
>> $_ + "`nImport-Module $PSScriptRoot\EnvManager -Force"
>> }
>> else {
>> $_
>> }
>> } | Set-Content $profilePath
(rtx5070_env) PS E:\PyTorch_Build\pytorch>
(rtx5070_env) PS E:\PyTorch_Build\pytorch> # 创建模块加载器
(rtx5070_env) PS E:\PyTorch_Build\pytorch> $modulePath = "C:\Users\Administrator\Documents\PowerShell\Modules\EnvManager"
(rtx5070_env) PS E:\PyTorch_Build\pytorch> New-Item -ItemType Directory -Path $modulePath -Force | Out-Null
(rtx5070_env) PS E:\PyTorch_Build\pytorch> @"
>> # EnvManager.psm1
>> function Set-PythonEnv {
>> # 修正后的实现代码...
>> }
>>
>> Export-ModuleMember -Function Set-PythonEnv
>> "@ | Set-Content "$modulePath\EnvManager.psm1"
(rtx5070_env) PS E:\PyTorch_Build\pytorch>
(rtx5070_env) PS E:\PyTorch_Build\pytorch> Write-Host "PowerShell配置文件已修复,问题命令已注释" -ForegroundColor Green
PowerShell配置文件已修复,问题命令已注释
(rtx5070_env) PS E:\PyTorch_Build\pytorch> # 禁用WSL更新提示 (disable_wsl_prompt.ps1)
(rtx5070_env) PS E:\PyTorch_Build\pytorch> # 方法1:注册表禁用
(rtx5070_env) PS E:\PyTorch_Build\pytorch> New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModel\StateChange" `
>> -Name "DisableWSLUpdateNotification" `
>> -Value 1 `
>> -PropertyType DWORD `
>> -Force
DisableWSLUpdateNotification : 1
PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curren
tVersion\AppModel\StateChange
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curren
tVersion\AppModel
PSChildName : StateChange
PSDrive : HKLM
PSProvider : Microsoft.PowerShell.Core\Registry
(rtx5070_env) PS E:\PyTorch_Build\pytorch>
(rtx5070_env) PS E:\PyTorch_Build\pytorch> # 方法2:修改VS Code设置
(rtx5070_env) PS E:\PyTorch_Build\pytorch> $vscodeSettings = @{
>> "wsl.deprecated" = @{
>> "showDeprecatedNotification" = $false
>> };
>> "extensions.ignoreRecommendations" = $true;
>> }
(rtx5070_env) PS E:\PyTorch_Build\pytorch> $json = $vscodeSettings | ConvertTo-Json -Depth 3
(rtx5070_env) PS E:\PyTorch_Build\pytorch> Set-Content -Path "$env:APPDATA\Code\User\settings.json" -Value $json
(rtx5070_env) PS E:\PyTorch_Build\pytorch>
(rtx5070_env) PS E:\PyTorch_Build\pytorch> # 方法3:禁用WSL服务(如果不使用)
(rtx5070_env) PS E:\PyTorch_Build\pytorch> Stop-Service "LxssManager" -Force
Stop-Service: Cannot find any service with service name 'LxssManager'.
(rtx5070_env) PS E:\PyTorch_Build\pytorch> Set-Service "LxssManager" -StartupType Disabled
Set-Service: Service 'LxssManager' was not found on computer '.'.
(rtx5070_env) PS E:\PyTorch_Build\pytorch>
(rtx5070_env) PS E:\PyTorch_Build\pytorch> Write-Host "WSL更新提示已禁用" -ForegroundColor Green
WSL更新提示已禁用
(rtx5070_env) PS E:\PyTorch_Build\pytorch> sequenceDiagram
sequenceDiagram: The term 'sequenceDiagram' 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> participant 用户
participant: The term 'participant' 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> participant PowerShell
participant: The term 'participant' 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> participant VS Code
participant: The term 'participant' 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> 用户->>PowerShell: 运行 validate_paths.ps1
用户->>PowerShell:: The term '用户->>PowerShell:' 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> PowerShell->>系统: 验证所有工具路径
PowerShell->>系统:: The term 'PowerShell->>系统:' 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> PowerShell-->>用户: 显示验证结果
PowerShell-->>用户:: The term 'PowerShell-->>用户:' 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> 用户->>PowerShell: 运行 fix_profile.ps1
用户->>PowerShell:: The term '用户->>PowerShell:' 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> PowerShell->>系统: 修复配置文件
PowerShell->>系统:: The term 'PowerShell->>系统:' 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> PowerShell-->>用户: 确认修复完成
PowerShell-->>用户:: The term 'PowerShell-->>用户:' 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> 用户->>PowerShell: 运行 disable_wsl_prompt.ps1
用户->>PowerShell:: The term '用户->>PowerShell:' 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> PowerShell->>系统: 禁用WSL提示
PowerShell->>系统:: The term 'PowerShell->>系统:' 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> PowerShell-->>用户: 确认禁用成功
PowerShell-->>用户:: The term 'PowerShell-->>用户:' 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> 用户->>VS Code: 启动
用户->>VS: The term '用户->>VS' 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> VS Code-->>用户: 无WSL提示
VS: The term 'VS' 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> # 最终验证脚本 (final_check.ps1)
(rtx5070_env) PS E:\PyTorch_Build\pytorch> Write-Host "=== 环境路径验证 ===" -ForegroundColor Cyan
=== 环境路径验证 ===
(rtx5070_env) PS E:\PyTorch_Build\pytorch> .\validate_paths.ps1
.\validate_paths.ps1: The term '.\validate_paths.ps1' 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> Write-Host "`n=== PowerShell问题验证 ===" -ForegroundColor Cyan
=== PowerShell问题验证 ===
(rtx5070_env) PS E:\PyTorch_Build\pytorch> if (Get-Command Set-PythonEnv -ErrorAction SilentlyContinue) {
>> Write-Host "环境切换功能正常" -ForegroundColor Green
>> } else {
>> Write-Host "环境切换功能修复失败" -ForegroundColor Red
>> }
环境切换功能正常
(rtx5070_env) PS E:\PyTorch_Build\pytorch>
(rtx5070_env) PS E:\PyTorch_Build\pytorch> Write-Host "`n=== 核心问题验证 ===" -ForegroundColor Cyan
=== 核心问题验证 ===
(rtx5070_env) PS E:\PyTorch_Build\pytorch> Write-Host "1. 环境隔离:"
1. 环境隔离:
(rtx5070_env) PS E:\PyTorch_Build\pytorch> Switch-Environment Global
Switch-Environment: The term 'Switch-Environment' 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> Switch-Environment PyTorch
Switch-Environment: The term 'Switch-Environment' 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> Write-Host "`n2. 依赖锁定:"
2. 依赖锁定:
(rtx5070_env) PS E:\PyTorch_Build\pytorch> Lock-Dependencies
Lock-Dependencies: The term 'Lock-Dependencies' 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> Write-Host "依赖锁定状态: $(if (Test-Dependencies) {'✅ 正常'} else {'❌ 异常'})"
Test-Dependencies: The term 'Test-Dependencies' 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> Write-Host "`n3. 路径污染:"
3. 路径污染:
(rtx5070_env) PS E:\PyTorch_Build\pytorch> Clean-Path
Clean-Path: The term 'Clean-Path' 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> Write-Host "当前PATH: $($env:PATH -replace ';', "`n")"
当前PATH: E:\PyTorch_Build\pytorch\rtx5070_env\Scripts
C:\Program Files\PowerShell\7
E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin
E:\Program Files\NVIDIA\CUNND\v9.12\bin\13.0
E:\Program Files\NVIDIA\CUNND\v9.12\lib\13.0\x64
E:\Program Files\CMake\bin
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\bin\Hostx64\x64
E:\Python310\Scripts
E:\PyTorch_Build\pytorch\rtx5070_env\Scripts
C:\Program Files\PowerShell\7
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\libnvvp
C:\Miniconda3\condabin
C:\Miniconda3\Scripts
E:\PyTorch_Build\pytorch\pytorch_env\Scripts
C:\Program Files\PowerShell\7
E:\PyTorch_Build\pytorch\pytorch_env\Scripts
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
C:\Users\Administrator\miniconda3\Scripts
E:\Program Files\Rust\.cargo\bin
C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps
C:\Users\Administrator\.dotnet\tools
C:\Users\Administrator\miniconda3\Scripts
E:\Program Files\Rust\.cargo\bin
C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps
C:\Users\Administrator\.dotnet\tools
C:\ProgramData\mingw64\mingw64\bin
E:\Program Files\7-Zip
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64
E:\Program Files\7-Zip
E:\Program Files\Rust\.cargo\bin
C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps
C:\Users\Administrator\.dotnet\tools
C:\ProgramData\mingw64\mingw64\bin
(rtx5070_env) PS E:\PyTorch_Build\pytorch>
最新发布