Skip to content

Instantly share code, notes, and snippets.

@coderhh
Last active April 3, 2025 11:59
Show Gist options
  • Save coderhh/c2d4bb0812d5a6804c589b19c31a6975 to your computer and use it in GitHub Desktop.
Save coderhh/c2d4bb0812d5a6804c589b19c31a6975 to your computer and use it in GitHub Desktop.
PowerShell Script to setup tensorflow gpu on Windows 10
<#
Script to setup gpu support for tensorflow on Windows 10
Author: Yehang Han
#>
# 1. Install Microsoft Visual C++ Compiler
if (Get-Module -ListAvailable -Name VSSetup) {
Write-Host "Module VSSetup exists"
}
else {
Write-Host "Module VSSetup does not exist"
Install-Module -Name VSSetup
}
if (Get-VSSetupInstance -All | Select-VSSetupInstance -Require 'Microsoft.VisualStudio.Workload.ManagedDesktop' -Latest) {
Write-Host "Microsoft Visual C++ Compiler exist"
}
else {
Write-Host "Microsoft Visual C++ Compiler not exist"
Invoke-Webrequest -uri "https://download.visualstudio.microsoft.com/download/pr/9fcc1f0c-c63f-4424-bc46-7351a59fba06/1ed7863dc633c57c42a88c5cef907048/vs_community.exe" -OutFile vs_community.exe
#Start-Process -NoNewWindow -FilePath "vs_community.exe" -ArgumentList "--layout c:\vslayout","--add Microsoft.VisualStudio.Workload.NativeDesktop","--includeRecommended", "--lang en-US"
}
Invoke-Webrequest -uri "https://download.visualstudio.microsoft.com/download/pr/9fcc1f0c-c63f-4424-bc46-7351a59fba06/1ed7863dc633c57c42a88c5cef907048/vs_community.exe" -OutFile vs_community.exe
#Start-Process -NoNewWindow -FilePath "vs_community.exe" -ArgumentList "--layout c:\vslayout","--add Microsoft.VisualStudio.Workload.NativeDesktop","--includeRecommended", "--lang en-US"
#Start-Process -NoNewWindow -FilePath "c:\vslayout\vs_community.exe" -ArgumentList "--noweb", "--add Microsoft.VisualStudio.Workload.NativeDesktop","--includeOptional"
#c:\vslayout\vs_community.exe --noweb --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NetWeb --add Component.GitHub.VisualStudio --includeOptional
#vs_community.exe --layout c:\vslayout --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --lang en-US
# 2. Install CUDA Toolkit
# 3. Install cuDNN
# 4. Install TensorFlow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment