title: powershell to run pip
body: <p>I want to run python modules upgrades vie powershell script.
     First line works.<br>
     But I do not know how to read the file correctly into
     the second pip line.  I get this error:</p>
  
  <pre><code>Could not find a version that satisfies the requirement Get-Content   
  
  pip freeze| Out-File requirements.txt 
  pip install --upgrade  Get-Content requirements.txt
  Remove-Item  requirements.txt
  </code></pre>
  
  <p>UPDATE: Works now with changed second line.</p>
  
  <pre><code>    pip freeze| Out-File requirements.txt 
  
      foreach($line in Get-Content requirements.txt) 
      {
        pip install --upgrade $line 
      }  
  
      Remove-Item  requirements.txt
  </code></pre>
  
  <p>UPDATE 2  Now with python 3.6 I use this script.</p>
  
  <pre><code>$(
  $exclude = 'virtualenv', 'prompt-toolkit'
  pip list --outdated --format=freeze  | ForEach{ $_.split("=")[0]} | Where-Object { $exclude -notcontains $_ } | ForEach { pip install -U $_ }                               
  ) *&gt;&amp;1 &gt;&gt; Python_Modules_Updates_Log.txt
  </code></pre>