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.
Note: You may need to open a PowerShell windows and enable the execution of unsigned digital scripts with:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy BypassDownload 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.ps1If 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)
To install pip, you should navigate to the python_embedded folder first:
cd ./python_embeddedThen, run the following command:
.\python get-pip.pyNote: You only need to do this once.
To install new modules, you should navigate to the python_embedded folder first:
cd ./python_embeddedThen, run the following command:
.\python.exe -m pip install YOURMODULEFrom the root of this project, watch the following example to run test.py inside of test_script folder:
.\python_embedded\python .\test_script\test.pyYou should see Hello World! on the terminal
To see the list of libraries, you should navigate to the python_embedded folder first:
cd ./python_embeddedThen, run the following command:
.\python.exe -m pip listNavigate to the python_embedded folder first:
cd ./python_embeddedThen, save the list of installed libraries to a file:
.\python.exe -m pip freeze > ..\requirements.txtNote: The requirements.txt file will be saved at the root of this project.
Navigate to the python_embedded folder first:
cd ./python_embeddedThen, execute:
.\python.exe -m pip install -r ..\requirements.txtYou 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.