{"id":15021209,"url":"https://github.com/jtmoon79/pythonembed4win","last_synced_at":"2025-08-21T13:32:59.072Z","repository":{"id":97500712,"uuid":"467007359","full_name":"jtmoon79/PythonEmbed4Win","owner":"jtmoon79","description":"Quickly setup a portable python environment for Windows.","archived":false,"fork":false,"pushed_at":"2024-10-28T00:54:31.000Z","size":80,"stargazers_count":41,"open_issues_count":4,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-12-14T16:04:36.494Z","etag":null,"topics":["powershell","powershell-script","python","python-virtualenv","windows"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jtmoon79.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-07T08:31:33.000Z","updated_at":"2024-12-09T02:20:57.000Z","dependencies_parsed_at":"2023-12-16T08:43:20.434Z","dependency_job_id":"9de22fbb-1bc1-4f69-a772-8e2c9776c579","html_url":"https://github.com/jtmoon79/PythonEmbed4Win","commit_stats":{"total_commits":63,"total_committers":2,"mean_commits":31.5,"dds":"0.015873015873015928","last_synced_commit":"94fe81608207e393727b161e86235f9b31a61acb"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtmoon79%2FPythonEmbed4Win","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtmoon79%2FPythonEmbed4Win/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtmoon79%2FPythonEmbed4Win/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtmoon79%2FPythonEmbed4Win/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jtmoon79","download_url":"https://codeload.github.com/jtmoon79/PythonEmbed4Win/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230516192,"owners_count":18238353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["powershell","powershell-script","python","python-virtualenv","windows"],"created_at":"2024-09-24T19:56:17.780Z","updated_at":"2025-08-21T13:32:59.066Z","avatar_url":"https://github.com/jtmoon79.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PythonEmbed4Win\n\n![PowerShell 5](https://img.shields.io/badge/5-blue?logo=Powershell\u0026logoColor=blue\u0026label=PowerShell\u0026labelColor=white\u0026color=blue) ![PowerShell 7](https://img.shields.io/badge/7-blue?logo=Powershell\u0026logoColor=purple\u0026label=PowerShell\u0026labelColor=white\u0026color=purple)\n![Python Versions](https://img.shields.io/badge/3.6%20%7C%203.7%20%7C%203.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue?logo=Python\u0026logoColor=yellow\u0026label=Python\u0026labelColor=blue\u0026color=white)\n\nA [single PowerShell script](PythonEmbed4Win.ps1) to easily and quickly\ncreate a standalone Python local environment for Windows by downloading the requested `embed.zip`\ndistributed file. No prior Python installation is required.\n\n## Download and run\n\n```powershell\nInvoke-WebRequest -Uri \"https://raw.githubusercontent.com/jtmoon79/PythonEmbed4Win/main/PythonEmbed4Win.ps1\" -OutFile \"PythonEmbed4Win.ps1\"\n.\\PythonEmbed4Win.ps1\n```\n\nIf you get the error\u003cbr/\u003e `PythonEmbed4Win.ps1 cannot be loaded because running scripts is disabled on this system`\u003cbr/\u003e\nthen run:\n\n```powershell\nSet-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process\n```\n\n## About\n\nInstalling the Python for Windows embedded zip file requires some tedious tweaks.\nSee this [gist](https://gist.github.com/jtmoon79/ce63fe655b2f544462e70d8e5ec30ff5).\nThis script will handle the tedious tweaks and updates so the new Python\ninstallation will run correctly in an isolated manner.\n\nThis is similar to a Python Virtual Environment but technically is not.\nIt does not require an _activate_ script to set environment variable `VIRTUAL_ENV`\nor modify the `PATH`. It will run isolated without environment modifications.\n\nOne disadvantage is that a Windows embed Python cannot create a functioning\nvirtual environment. They will be created but `virtualenv` and `venv`\nselectively copy files from the source and do not copy necessary library files\nunique to an Windows embed Python.\n\nDerived from [this StackOverflow answer](https://stackoverflow.com/a/68958636/471376).\n\n## help\n\n```plain-text\nPS\u003e Get-Help ./PythonEmbed4Win.ps1 -full\n\nNAME\n    ./PythonEmbed4Win.ps1\n    \nSYNOPSIS\n    Quickly setup a portable python environment for Windows using an embed.zip.\n    \n    \nSYNTAX\n    ./PythonEmbed4Win.ps1 [-Path \u003cString\u003e] [-Version \u003cString\u003e] [-Arch \u003cString\u003e] [-SkipExec] [-trace] [\u003cCommonParameters\u003e]\n\n    ./PythonEmbed4Win.ps1 -ZipFile \u003cString\u003e [-Path \u003cString\u003e] [-SkipExec] [-trace] [\u003cCommonParameters\u003e]\n    \n    ./PythonEmbed4Win.ps1 -UriCheck [[-Path] \u003cString\u003e] [-Version \u003cString\u003e] [-Arch \u003cString\u003e] [-trace] [\u003cCommonParameters\u003e]\n    \n    \nDESCRIPTION\n    Quickly setup a portable self-referential python environment for Windows. No\n    prior python installation is needed. The python code is downloaded\n    from the web (https://www.python.org/ftp/python/).\n    \n    If no -Version is passed then the latest Python version is chosen.\n    If only Version major.minor passed then chooses latest major.minor.micro version.\n    e.g. passing \"-Version 3.8\" will choose Python 3.8.12.\n    \n    The installation uses the Windows \"Embedded\" distribution zip file,\n    e.g. python-3.8.12-embed-amd64.zip\n    That zip file distribution requires tedious and non-obvious steps.\n    This script adjusts the installation to be runnable and isolated (removes\n    references to python paths outside it's own directory).\n    This script also installs latest pip.\n    \n    Python 3.6 and later is supported.\n    \n    -ZipFile allows installing a local .zip file.\n     The .zip file must have an embedded version string within the basename.\n    \n    -UriCheck is merely a self-test to see which URIs for embed.zip files\n     are valid.\n    \n    The installed Python distribution is like a Python Virtual Environment but\n    technically is not. It does not set environment variable VIRTUAL_ENV nor\n    modify the PATH.\n    Users of this installation must call the `python.exe` executable. Do not\n    call other modules by their script entrypoint,\n    e.g. for using pip, do not\n        C:/path/to/embed/Scripts/pip.exe install ...\n    do\n        C:/path/to/embed/Scripts/python.exe -m pip install ...\n    \n    Inspired by this stackoverflow.com question:\n    https://stackoverflow.com/questions/68958635/python-windows-embeddable-package-fails-to-run-no-module-named-pip-the-system/68958636\n    \n    BUG: Some embed.zip for a few releases are hardcoded to look for other\n         Windows Python installations.\n         For example, if you install Python-3.8.6.msi and then run this script to\n         install python-3.8.4-embed-amd64.zip, the embed Python 3.8.4 sys.path\n         will be the confusing paths:\n             C:\\python-embed-3.8.4\\python38.zip\n             C:\\python-msi-install-3.8.6\\Lib\n             C:\\python-msi-install-3.8.6\\DLLs\n             C:\\python-embed-3.8.4\n             C:\\python-msi-install-3.8.6\n             C:\\python-msi-install-3.8.6\\lib\\site-packages\n          The python._pth and sitecustomize.py seem to have no affect.\n          As of November 2023, the latest version of supported Pythons,\n          3.6 to 3.12, appear to behave correctly. It only affects a few\n          intermediate releases.\n    \n\nPARAMETERS\n    -ZipFile \u003cString\u003e\n        Install this local .zip file. Does not download. The .zip file must have a version string\n        embedded in the basename.\n        \n        Required?                    true\n        Position?                    named\n        Default value                \n        Accept pipeline input?       false\n        Accept wildcard characters?  false\n        \n    -UriCheck [\u003cSwitchParameter\u003e]\n        Only check pre-filled URIs (script self-test). Does not install Python.\n        \n        Required?                    true\n        Position?                    named\n        Default value                False\n        Accept pipeline input?       false\n        Accept wildcard characters?  false\n        \n    -Path \u003cString\u003e\n        Install to this path. Defaults to a descriptive name.\n        Default pipeline value and default argument value.\n        \n        Required?                    false\n        Position?                    1\n        Default value                \n        Accept pipeline input?       true (ByValue)\n        Accept wildcard characters?  false\n        \n    -Version \u003cString\u003e\n        Version of Python to install. Leave blank to fetch the latest Python.\n        Can pass major.minor.micro or just major.minor, e.g. \"3.8.2\" or \"3.8\".\n        If passed only major.minor then the latest major.minor.micro will be chosen.\n        Python 3.6 and later is supported.\n        \n        Required?                    false\n        Position?                    named\n        Default value                \n        Accept pipeline input?       false\n        Accept wildcard characters?  false\n        \n    -Arch \u003cString\u003e\n        Architecture: win32 or amd64 or arm64. Defaults to the current architecture.\n        \n        Required?                    false\n        Position?                    named\n        Default value                \n        Accept pipeline input?       false\n        Accept wildcard characters?  false\n        \n    -SkipExec [\u003cSwitchParameter\u003e]\n        Do not execute python.exe after installation.\n        This skips the python.exe self-test and the run of `get-pip.py`.\n        \n        Required?                    false\n        Position?                    named\n        Default value                False\n        Accept pipeline input?       false\n        Accept wildcard characters?  false\n        \n    -trace [\u003cSwitchParameter\u003e]\n        Turn on debug tracing.\n        \n        Required?                    false\n        Position?                    named\n        Default value                False\n        Accept pipeline input?       false\n        Accept wildcard characters?  false\n        \n    \u003cCommonParameters\u003e\n        This cmdlet supports the common parameters: Verbose, Debug,\n        ErrorAction, ErrorVariable, WarningAction, WarningVariable,\n        OutBuffer, PipelineVariable, and OutVariable. For more information, see\n        about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). \n    \nINPUTS\n    \nOUTPUTS\n    \nNOTES\n    \n    \n        Author: James Thomas Moon\n    \n    \nRELATED LINKS\n    https://github.com/jtmoon79/PythonEmbed4Win\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtmoon79%2Fpythonembed4win","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjtmoon79%2Fpythonembed4win","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtmoon79%2Fpythonembed4win/lists"}