/Portable-Python

Creates a lightweight portable python installation from the official python.org

Primary LanguageAutoHotkey

Portable-Python

This shows how you can create a portable installation of Python from the official python.org website. The following script merely automates the steps you need to do to get a working embedded version up and running.

Steps

Make sure you download the Windows embeddable package (64-bit) from:

https://www.python.org/downloads/windows/
  • Drop the Fix Python.ahk script (or Fix Python.exe) into the extracted zip directory.
  • Double check there is a python.exe in the folder.
  • Double click the Fix Python.ahk script.

If successful, the script will self delete.

image

Additional Useful Scripts

You might find it useful to add python to your bin folder or PATH:

@echo off
"%~dp0python\python.exe" %*

You can also suppress the pip warnings

@echo off
if /I "%1"=="install" ("%~dp0python\scripts\pip.exe" %* --no-warn-script-location) else ("%~dp0python\scripts\pip.exe" %*)

Both scripts assume your main folder is called "python" and are dropped in the same directory as the folder called python.

image

You can change the path by adding something between %~dp0 and python such as:

"%~dp0Documents\python\python.exe" %*

which translates to:

.\Documents\python\python.exe