Python on a thumbdrive

T

TuxTrax

Hi all

I use a macintosh and a pc at home. On My Mac, I have python
installed. But my Pc hard drive recently failed and I have been
running Damn Small Linux, a derivitave of Knoppix Linux direct from
the cd.

I like Damn small Linux much better than Knoppix, but DSL dosen't have
python. An idea came to me: what if I could load a complete python
distribution for unix onto a jumpdrive (also known as a thumbdrive or
USB drive), those inexpensive flash memory stick drives that plug into
the USB port. then I cold take python with me wherever I went. In
fact, I could have versions for all platforms I was likely to
encounter!

so I bought a 128 meg jumpdrive and copied the python 2.3 directory
from the knoppix disk to the jumpdrive. It copied fine. So I tried
running it. Thats where the problems started.

Becuase there was no linux installation on the jumpdrive, python
looked to the ramdrive where all the usual files would be stored, and
not finding them, gave me the following errors:

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Import site failed; use -v for traceback
Python 2.3.3 (#2, May 1 2004, 06:12:12)
[GCC 3.3.3 (debian 20040401)] on Linux 2
Type "help", "copyright", "credits" or "license", for more
information.
Unlike the windows and Mac versions, you have to compile the Linux
version which is why I copied it off of the Knoppix CD. due to my lack
of a hard drive on the PC, I don't have GCC and it's associated files,
and my lack of a swap file makes it impossible to compile from the
Knoppix version of GCC due to only having 64 Megs of memory in the PC.

I tried setting pythonhome from Bash:

PYTHONHOME="/mnt/sda1/python/python2.3"

No dice. Same errors.

Any help achieving my goals of having a transportable python install
on a jumpdrive would be greatly appreciated.

regards,

Mathew
 
C

Christophe Cavalaria

TuxTrax said:
I tried setting pythonhome from Bash:

PYTHONHOME="/mnt/sda1/python/python2.3"

If you did it like that it's a mistake :

$ PYTHONHOME="/mnt/sda1/python/python2.3"
$ /mnt/sda1/python/python

Do that instead :
$ export PYTHONHOME="/mnt/sda1/python/python2.3"
$ /mnt/sda1/python/python
 
T

TuxTrax

Christophe Cavalaria said:
If you did it like that it's a mistake :

$ PYTHONHOME="/mnt/sda1/python/python2.3"
$ /mnt/sda1/python/python

Do that instead :
$ export PYTHONHOME="/mnt/sda1/python/python2.3"
$ /mnt/sda1/python/python

Thanks, that did the trick except for one remaining error on startup.

I moved the python executable into the python2.3 directory (which is
inside a directory simply called "python"), with the other python
files and directories. I then used the following line in my .bashrc
file:

export PYTHONHOME="/mnt/sda1/python/python2.3"

I don't get the errors on the internal and external component loads
when I start up python now, but I sill get one last error: 'import
site failed'; use -v for traceback

Yet 'site.py' and 'site.pyc' exist in the python2.3 directory. When I
type:

after the initial python import error on starting python up, There are
no errors or complaints from python, and the module seems to have been
loaded in just fine.

Thanks for the help,

Mathew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top