> Is there a way to 'install' and use Python on a memory stick, just as
> you would on any computer? I use Windows, and I know the installation
> does things with the registry, so probably I couldn't use the executable
> file to install it.
just install it as usual on C:, and copy the \python24 directory, plus the python24.dll
from \windows\system32, to a suitable directory on the stick. you can use a tool like
exemaker:
http://effbot.org/zone/exemaker.htm
to provide EXE loaders for your scripts.
</F>
Google for Movable Python.
--
Cheers,
Simon B,
si...@brunningonline.net,
http://www.brunningonline.net/simon/blog/
Eh, call me uptight but I like using the "authentic" version of Python,
not any kinds of special versions with extra add-ons, especially ones
I'd have to pay for.
Interesting. I didn't think it would be that easy. But I don't think I
fully understand what exemaker does. Another question I had was since I
won't be using a Windows registry, would I have to put the #! line on my
scripts like in Linux? Is this what exemaker takes care of? Is it
possible to *not* use exemaker, but still run scripts from the stick
(such as with using the #! line?).
Thanks.
> Interesting. I didn't think it would be that easy. But I don't think I
> fully understand what exemaker does. Another question I had was since I
> won't be using a Windows registry, would I have to put the #! line on my
> scripts like in Linux?
windows doesn't care about the #! line, so you'd have to run the
scripts as e.g.
e:\py24\python.exe myscript.py
> Is this what exemaker takes care of?
exemaker simply maps
foobar.exe
to
python.exe foobar.py
and uses the #! line plus a bunch of heuristics to locate the various parts
of the Python install.
you can of course use BAT-files as well (but exemaker EXE's look like
real applications if you look at them in the task manager).
> Is it possible to *not* use exemaker, but still run scripts from the stick
sure (using the explicit "python.exe scriptfile" form).
</F>
Python looks for the libraries relative to python.exe. So you can copy
the Python installation directory to your memory stick (make sure that
python24.dll is included, this is copied to %windir%\system32 if you
have done the admin installation) and it should just work. You can test
that by renaming in your registry
HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.4 (or whatever version
you're using)
Daniel
Google for 'python on a memory stick" and follow the first link?
> windows doesn't care about the #! line, so you'd have to run the
> scripts as e.g.
>
> e:\py24\python.exe myscript.py
>
>> Is this what exemaker takes care of?
>
> exemaker simply maps
>
> foobar.exe
>
> to
>
> python.exe foobar.py
>
> and uses the #! line plus a bunch of heuristics to locate the various parts
> of the Python install.
>
> you can of course use BAT-files as well (but exemaker EXE's look like
> real applications if you look at them in the task manager).
>
>> Is it possible to *not* use exemaker, but still run scripts from the stick
>
> sure (using the explicit "python.exe scriptfile" form).
>
> </F>
>
>
>
Thanks a lot for the help! I'll look into this.
I use Python in connection with Cygwin from USB stick for more than a
year. Simply install cygwin on the stick (or copy it from a local
installation). Then use the following script to set the registry
entries before you first run any cygwin program. Now you have Python
in every Internet Cafe in the world ;-)...
,--- * mkcygwin.bat
| @ echo off
| set MOUNT=\cygwin\bin\mount -xfub
|
| title [cygwin] importing settings
|
| REM umount -c, umount -A
| reg delete "hklm\software\cygnus solutions" /f > nul 2>&1
| reg delete "hkcu\software\cygnus solutions" /f > nul 2>&1
|
| %MOUNT% --change-cygdrive-prefix /cygdrive
| %MOUNT% %~d0\cygwin /
| %MOUNT% %~d0\cygwin/bin /usr/bin
| %MOUNT% %~d0\cygwin/lib /usr/lib
| %MOUNT% %TEMP% /tmp
`---
Do you actually want a full python environment? Or do you just want an
easy way to run your scripts on another machine?
If the latter, then look at http://www.py2exe.org/ - "convert python
scripts into standalone windows programs".
Jonathan.