Equivalent of Python Virtual Environment in PowerShell

Welcome Forums General PowerShell Q&A Equivalent of Python Virtual Environment in PowerShell

Viewing 2 reply threads
  • Author
    Posts
    • #238841
      Participant
      Topics: 62
      Replies: 91
      Points: 65
      Rank: Member

      Long time PowerShell user, and I have been doing a bit study of Python.

      One of the things that intrigued me was the use of virtual environments, venv. In a nutshell it creates a sandbox environment which you can load up older version of Python or any other modules that you want to pull. Once you have what you need or download the module you can ‘freeze’ it and output as a ‘requirements.txt’ file. We can then create a new venv and use the same requirements.txt to download the same set up again.

      I like the idea because  I can run modules in an isolated manner.

      I am just wondering whether PowerShell has anything like this? I would love to use something like this.

       

    • #239114
      Participant
      Topics: 3
      Replies: 431
      Points: 1,533
      Helping Hand
      Rank: Community Hero

      If the purpose is to have a restricted environment you can look at custom pssession configurations. https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_session_configurations?view=powershell-7  also referred to as “JEA” – just enough administration.

    • #239126
      Participant
      Topics: 62
      Replies: 91
      Points: 65
      Rank: Member

      JEA is different. It’s purpose is security. It also works against remote endpoints as oppose  to local.

      Venv is used to isolate modules to versions. I could have different versions of a modules on the system but venv allows me to sandbox to particular ones

Viewing 2 reply threads
  • You must be logged in to reply to this topic.