Portable Python (Windows)
The instance of non virtualized Python that is not dependent on the system path and can run independently. You can move python portable anywhere on your computer or to another computer. You can have more than one instance of portable python running simultaneously on your system. You can also have the combination of traditionally installed Python and portable Python.
The barebone of the Python portable is relatively small. It is not more than 9Mb in the 7z archive.
How to use
Note: You may need to open a PowerShell windows and enable the execution of unsigned digital scripts with:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
Download or clone this project and run portablepython3-11-9.ps1. By default portablepython3-11-9.ps1 will setup Python 3.11.9 in the python_embedded folder.
You can use the terminal too, if you prefer:
.\portablepython3-11-9.ps1
If you desire to change the version, please use the terminal with the source argument:
.\portablepython3-11-9.ps1 -source "https://www.python.org/ftp/python/3.9.10/python-3.9.10-embed-amd64.zip"
Link for Python versions
If you desire to change the destination folder, use the terminal with the destination argument:
.\portablepython3-11-9.ps1 -destination "C:\new-path\PortablePython\"
Note: Path to a directory should always end with \ (back space)
Install PIP
To install pip, you should navigate to the python_embedded folder first:
Then, run the following command:
Note: You only need to do this once.
Running PIP
To install new modules, you should navigate to the python_embedded folder first:
Then, run the following command:
.\python.exe -m pip install YOURMODULERunning Scripts
From the root of this project, watch the following example to run test.py inside of test_script folder:
.\python_embedded\python .\test_script\test.py
You should see Hello World! on the terminal
List of libraries installed on the portable version
To see the list of libraries, you should navigate to the python_embedded folder first:
Then, run the following command:
Saving the List of Installed Libraries
Navigate to the python_embedded folder first:
Then, save the list of installed libraries to a file:
.\python.exe -m pip freeze > ..\requirements.txt
Note: The requirements.txt file will be saved at the root of this project.
Install Libraries from a requirements.txt
Navigate to the python_embedded folder first:
Then, execute:
.\python.exe -m pip install -r ..\requirements.txt
You can try with the requirements_test.txt file.
Note: requirements.txt must exist on the root of this project. Note that you must be inside of the python_embedded folder, because it needs importlib and it could trigger stderr message if doesn't find it.