Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

running python from a memory stick?

1 view
Skip to first unread message

John Salerno

unread,
Jul 13, 2006, 9:54:00 AM7/13/06
to
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. But is it possible to do it some other way, such as
how you might build it yourself on Linux (although I don't know how to
do that yet) and then just write and run scripts normally straight from
your memory stick?

Fredrik Lundh

unread,
Jul 13, 2006, 10:03:54 AM7/13/06
to pytho...@python.org
John Salerno wrote:

> 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>

Simon Brunning

unread,
Jul 13, 2006, 10:07:21 AM7/13/06
to John Salerno, pytho...@python.org

Google for Movable Python.

--
Cheers,
Simon B,
si...@brunningonline.net,
http://www.brunningonline.net/simon/blog/

John Salerno

unread,
Jul 13, 2006, 10:15:24 AM7/13/06
to
Simon Brunning wrote:
> On 7/13/06, John Salerno <john...@nospamgmail.com> wrote:
>> 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. But is it possible to do it some other way, such as
>> how you might build it yourself on Linux (although I don't know how to
>> do that yet) and then just write and run scripts normally straight from
>> your memory stick?
>
> Google for Movable Python.
>

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.

John Salerno

unread,
Jul 13, 2006, 10:18:52 AM7/13/06
to

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.

Fredrik Lundh

unread,
Jul 13, 2006, 10:36:43 AM7/13/06
to pytho...@python.org
John Salerno wrote:

> 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>

Daniel Dittmar

unread,
Jul 13, 2006, 10:34:58 AM7/13/06
to

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

Magnus Lycka

unread,
Jul 13, 2006, 10:09:42 AM7/13/06
to

Google for 'python on a memory stick" and follow the first link?

John Salerno

unread,
Jul 13, 2006, 11:33:12 AM7/13/06
to
Fredrik Lundh wrote:

> 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.

Thorsten Kampe

unread,
Jul 13, 2006, 12:08:20 PM7/13/06
to
* John Salerno (2006-07-13 14:54 +0000)

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
`---

Jonathan Harris

unread,
Jul 13, 2006, 1:44:38 PM7/13/06
to
John Salerno wrote:
> Is there a way to 'install' and use Python on a memory stick
...

> and then just write and run scripts normally straight from
> your memory stick?

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.

0 new messages