https://github.com/jtmoon79/pythonembed4win
Quickly setup a portable python environment for Windows.
https://github.com/jtmoon79/pythonembed4win
powershell powershell-script python python-virtualenv windows
Last synced: 7 months ago
JSON representation
Quickly setup a portable python environment for Windows.
- Host: GitHub
- URL: https://github.com/jtmoon79/pythonembed4win
- Owner: jtmoon79
- License: mit
- Created: 2022-03-07T08:31:33.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-28T00:54:31.000Z (9 months ago)
- Last Synced: 2024-12-14T16:04:36.494Z (7 months ago)
- Topics: powershell, powershell-script, python, python-virtualenv, windows
- Language: PowerShell
- Homepage:
- Size: 78.1 KB
- Stars: 41
- Watchers: 3
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PythonEmbed4Win
 
A [single PowerShell script](PythonEmbed4Win.ps1) to easily and quickly
create a standalone Python local environment for Windows by downloading the requested `embed.zip`
distributed file. No prior Python installation is required.To run:
```powershell
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/jtmoon79/PythonEmbed4Win/main/PythonEmbed4Win.ps1" -OutFile "PythonEmbed4Win.ps1"
.\PythonEmbed4Win.ps1
```For detailed help:
```powershell
Get-Help .\PythonEmbed4Win.ps1 -full
```If you get the error
`PythonEmbed4Win.ps1 cannot be loaded because running scripts is disabled on this system`
then run:```powershell
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
```
Installing the Python for Windows embedded zip file requires some tedious tweaks.
See this [gist](https://gist.github.com/jtmoon79/ce63fe655b2f544462e70d8e5ec30ff5).
This script will handle the tedious tweaks and updates so the new Python
installation will run correctly in an isolated manner.This is similar to a Python Virtual Environment but technically is not.
It does not require an _activate_ script to set environment variable `VIRTUAL_ENV`
or modify the `PATH`. It will run isolated without environment modifications.One disadvantage is that a Windows embed Python cannot create a functioning
virtual environment. They will be created but `virtualenv` and `venv`
selectively copy files from the source and do not copy necessary library files
unique to an Windows embed Python.Derived from [this StackOverflow answer](https://stackoverflow.com/a/68958636/471376).