Creating a Portable Python (local install) for Linux

后端 未结 7 1128
醉酒成梦
醉酒成梦 2021-02-07 15:53

I\'m looking to create the following:

A portable version of python that can be run on any system (with any previous version of python or no python installed) and have it

7条回答
  •  时光说笑
    2021-02-07 16:44

    I just tested this and it works great.

    Get the copy of python you want to install and untar it and cd to the untarred folder first.

    Also get a copy of setuptools and untar that.

    /opt/portapy used below is of course just the name I came up with for this post, it could be any path and the full path should be tarred up and the same path should be used on any systems you put this on due to absolute path linking.

    mkdir /opt/portapy
    cd 
    ./configure --prefix=/opt/portapy && make && make install
    cd 
    /opt/portapy/bin/python ./setup.py install
    

    Make the virtual env folder inside the portapy folder.

    mkdir /opt/portapy/virtenv
    /opt/portapy/bin/virtualenv /opt/portapy/virtenv
    cd /opt/portapy/virtenv
    source bin/activate
    

    Done. You are ready to install all of your libraries here and have the option of creating multiple virtual envs this way.

    You can then tar up the whole /opt/portapy folder and transport it to any Linux system of the same arch, within reason I suspect.

    I compiled 2.7.5 ond centOS 5.8 64bit and moved the folder to a Cent6.9 system and it runs perfectly.

提交回复
热议问题