Updating PIP and installing Packages while using specific location of pip:
I was getting an intermittent error "Access Denied" when using the simple comand line pip install <library> on some lab machines that were using pip from a c:\users\... folder instead of the c:\Program Files\Python folder for all users.
Thanks to MultiplyByZer0 answer above I was able to implement a solution that specified the path to python and then run pip.
Here is the powershell script I use to force pip update and then install python libraries:
$fullPath = "C:\Program Files\Python38"
$thisApp = "python.exe"
$arguments = "-m pip install --upgrade pip"
$appPath = join-path $fullPath $thisApp
Start-Process $appPath $arguments -Verb RunAs -Wait
$packages = @( "pylint"
"pillow"
"pygame"
"matplotlib"
"pandas"
"godirect")
foreach ($package in $packages)
{
Write-Host "Installing python Package" $package -ForegroundColor Yellow
$arguments = "-m pip install $package"
Start-Process $appPath $arguments -Verb RunAs -Wait
}