How to create a fully autonomous Python environment?

I want to create a fully autonomous Python environment on a USB drive that can run on both Windows and GNU / Linux ....

How can i do this?

I tried to create Python with `./ 'as a prefix, but it does not work ... who has another idea?

Thanks in advance...

+3
source share
1 answer

Ok, I looked through http://svn.python.org/projects/python/branches/release31-maint/ and I found an interesting " readme " talking about the pyconfig.h file .

At http://svn.python.org/projects/python/branches/release31-maint/PC/pyconfig.h on line 82-83 there is a solution to my problem:

#ifndef PYTHONPATH
#   define PYTHONPATH L".\\DLLs;.\\lib;.\\lib\\plat-win"

, "PYTHONPATH" define, python, , GNU/Linux, Window, -, Python!

, ...


EDIT: , ! Python :

make PYTHONPATH=../lib:../Lib:./lib:./Lib

... Python `../lib '!

GNU/Linux, Windows, USB-, :

/mnt/key/
β”œβ”€β”€ AUTORUN.INF 
β”œβ”€β”€ Lib
β”‚   β”œβ”€β”€ os.py
β”‚   β”œβ”€β”€ sys.py
β”‚   β”œβ”€β”€ ...
β”‚   └── (Here i'll put the Python Standard Library)
β”œβ”€β”€ Linux
β”‚   └── python
└── Windows
    β”œβ”€β”€ python.exe
    └── pythonw.exe

+4

Source: https://habr.com/ru/post/1788802/


All Articles