Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Make Python as portable
#1
Hello Python users. Is there any way to use Python as portable ?

I have installed Python on my C:\Program Files, copy this folder somewhere in D:\ ... uninstall Python from C:\Program Files, and set PATH variables to the new location. But didn't work, every time when I try to run something, is telling me that Python is expecting to be on old installed location, not on new location.

So, is there a way to use Python as portable version ? No, I don't want to install Python to my custom location (D:\, or whatever), I only need to used as portable, without overload my registry ...

Regards,
Reply
#2
reinstall on D:

follow instructions here:
Windows install part1
Windows install part2
Reply
#3
User-Application installation
%LOCALAPPDATA%\Programs\Python\PythonXY

A normal user can install without administrative Rights software as User Application.
So, this is not system-wide, and it could not affect other user accounts.

Each user has its user-defined PATH variable, which can be set to the target directory.
The system-wide PATH is extended with the user-defined PATH.

System-Installation
Could be everywhere.
Requires administrative rights.

MS App Store
C:/Program Files/WindowsApps
No administrative rights required, but it's also limited in some areas.

Embedded Python
Could run everywhere. Download is here: https://www.python.org/downloads/windows/
Just take one of the embedded versions.
The stdlib is inside the zip file.


In general, the Python-Interpreter uses the Path where the binary is and will seek from this Path on all resources like site-packges in lib etc.
Often Modules and Packages do have scripts, which are placed in /Scripts. Modules like black, ipython, pip and many more are placed as exe files in the Scripts directory. So if you want to use them, you can execute them with an absolute Path (bad) or you put the Python Path and the Scripts PATH into your User Environment Variables.

How to set the Env: https://superuser.com/questions/949560/h...windows-10
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#4
(Jun-15-2021, 01:08 PM)Larz60+ Wrote: reinstall on D:

follow instructions here:
Windows install part1
Windows install part2

It worked. I have installed on D:\, copy installed folder on a USB stick, uninstall Python from D:\, and then I copied back on D:\, and everything is going well. In this way, I have Python on D:\, but not as installed application, and my registry is not overloaded for nothing.

Thank you for your support.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Portable Python Programs? GramophoneMimic 3 6,210 Apr-30-2019, 06:47 AM
Last Post: GramophoneMimic
  Portable Jupyter for Windows codekodo 2 66,361 Oct-30-2018, 01:43 AM
Last Post: codekodo
  Python / Spyder portable for Windows codekodo 0 7,233 Oct-24-2018, 03:04 AM
Last Post: codekodo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020