| Author |
Message |
Jonathan Harris *nix forums beginner
Joined: 04 Jul 2006
Posts: 3
|
Posted: Thu Jul 13, 2006 5:44 pm Post subject:
Re: running python from a memory stick?
|
|
|
John Salerno wrote:
| Quote: | 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. |
|
| Back to top |
|
 |
Thorsten Kampe *nix forums addict
Joined: 13 May 2005
Posts: 76
|
Posted: Thu Jul 13, 2006 4:08 pm Post subject:
Re: running python from a memory stick?
|
|
|
* John Salerno (2006-07-13 14:54 +0000)
| Quote: | 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
`--- |
|
| Back to top |
|
 |
John Salerno *nix forums Guru
Joined: 26 Oct 2005
Posts: 518
|
Posted: Thu Jul 13, 2006 3:33 pm Post subject:
Re: running python from a memory stick?
|
|
|
Fredrik Lundh wrote:
| Quote: | 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. |
|
|
| Back to top |
|
 |
Fredrik Lundh *nix forums Guru
Joined: 20 Feb 2005
Posts: 2415
|
Posted: Thu Jul 13, 2006 2:36 pm Post subject:
Re: running python from a memory stick?
|
|
|
John Salerno wrote:
| Quote: | 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
| Quote: | 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).
| Quote: | Is it possible to *not* use exemaker, but still run scripts from the stick
|
sure (using the explicit "python.exe scriptfile" form).
</F> |
|
| Back to top |
|
 |
Daniel Dittmar *nix forums addict
Joined: 28 Feb 2005
Posts: 93
|
Posted: Thu Jul 13, 2006 2:34 pm Post subject:
Re: running python from a memory stick?
|
|
|
John Salerno wrote:
| Quote: | 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 |
|
| Back to top |
|
 |
John Salerno *nix forums Guru
Joined: 26 Oct 2005
Posts: 518
|
Posted: Thu Jul 13, 2006 2:18 pm Post subject:
Re: running python from a memory stick?
|
|
|
Fredrik Lundh wrote:
| Quote: | 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. |
|
| Back to top |
|
 |
John Salerno *nix forums Guru
Joined: 26 Oct 2005
Posts: 518
|
Posted: Thu Jul 13, 2006 2:15 pm Post subject:
Re: running python from a memory stick?
|
|
|
Simon Brunning wrote:
| Quote: | On 7/13/06, John Salerno <johnjsal@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. |
|
| Back to top |
|
 |
Magnus Lycka *nix forums Guru
Joined: 19 May 2005
Posts: 352
|
Posted: Thu Jul 13, 2006 2:09 pm Post subject:
Re: running python from a memory stick?
|
|
|
John Salerno wrote:
| Quote: | 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? |
|
| Back to top |
|
 |
Simon Brunning *nix forums Guru Wannabe
Joined: 21 Feb 2005
Posts: 244
|
Posted: Thu Jul 13, 2006 2:07 pm Post subject:
Re: running python from a memory stick?
|
|
|
On 7/13/06, John Salerno <johnjsal@nospamgmail.com> wrote:
| Quote: | 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,
simon@brunningonline.net,
http://www.brunningonline.net/simon/blog/ |
|
| Back to top |
|
 |
Fredrik Lundh *nix forums Guru
Joined: 20 Feb 2005
Posts: 2415
|
Posted: Thu Jul 13, 2006 2:03 pm Post subject:
Re: running python from a memory stick?
|
|
|
John Salerno wrote:
| Quote: | 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> |
|
| Back to top |
|
 |
John Salerno *nix forums Guru
Joined: 26 Oct 2005
Posts: 518
|
Posted: Thu Jul 13, 2006 1:54 pm Post subject:
running python from a memory stick?
|
|
|
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? |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|