Mastodon Mastodon - Configure Python on Windows
 logo
  • Home 
  • Tags 
  • Blog posts 
  1. Home
  2. Blog posts
  3. Configure Python on Windows

Configure Python on Windows

Posted on March 22, 2020  (Last modified on July 11, 2024) • 1 min read • 147 words
Python   Windows   Dev   Configuration  
Python   Windows   Dev   Configuration  
Share via

All right, I have a Windows machine. It’s a PITA, but it’s here. And for some reason I started doing some Python testing on it. So this is how I managed to do it:

Preparation:

  • Install python with choco (choco install -y python)
  • Run PowerShell as Administrator
    • Execute Set-ExecutionPolicy -ExecutionPolicy Unrestricted (we’ll see why in a very short time)

Now to code it’s pretty similar to *NIX:

  • Create your code folder
  • Set up a python venv (python -m venv .env)
  • In VS Code, choose this interpreter

So why the PowerShell stuff? Cause to activate the environment VS Code needs to execute a .ps1 script. Which it can’t, cause “executing scripts is disabled on this machine”, which seems to be the default setting.

All in all, surprisingly straightforward. And I just noticed even the *NIX keyboard shortcuts (CTRL-A, CTRL-K, for example) work in the terminal window now. Crazy.

 SARS-CoV-2, a.k.a “Corona Virus”, pseudo “data science” and Twitter
Use autohotkey for text expansion on Windows 
In case you want to follow me

Here are some links. The further to the right, the less active.

           
(c) Axel Bock | Powered by Hinode.
Code copied to clipboard
Link copied to clipboard