By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,446 Members | 1,623 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,446 IT Pros & Developers. It's quick & easy.

running python from a memory stick?

P: n/a
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?
Jul 13 '06 #1
Share this Question
Share on Google+
10 Replies


P: n/a
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>

Jul 13 '06 #2

P: n/a
On 7/13/06, John Salerno <jo******@nospamgmail.comwrote:
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.

--
Cheers,
Simon B,
si***@brunningonline.net,
http://www.brunningonline.net/simon/blog/
Jul 13 '06 #3

P: n/a
Simon Brunning wrote:
On 7/13/06, John Salerno <jo******@nospamgmail.comwrote:
>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.
Jul 13 '06 #4

P: n/a
Fredrik Lundh wrote:
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.
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.
Jul 13 '06 #5

P: n/a
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>

Jul 13 '06 #6

P: n/a
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. 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?
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
Jul 13 '06 #7

P: n/a
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. 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 'python on a memory stick" and follow the first link?
Jul 13 '06 #8

P: n/a
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.
Jul 13 '06 #9

P: n/a
* John Salerno (2006-07-13 14:54 +0000)
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?
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
`---
Jul 13 '06 #10

P: n/a
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.
Jul 13 '06 #11

This discussion thread is closed

Replies have been disabled for this discussion.