Running Python on Windows XP

Learning PythonI got myself a copy of the O'Reilley "Learning Python" book and started working myway through it. For various reasons, I decided to try it on Windows; I thought the binary install would be easier and I am in the process of upgrading the Solaris version and I wanted to finish that first. The windows install from python.org is quite cute, as you would expect but it requires some further configuration before the python imports and module search works properly.

Firstly my "My Documents" is on a different disk to the Program Files directory. The Python interpreter is installed by default into the C:\\Program Files directory. This means that Python is not in the %PATH% string and that the icon for the Python CLI starts a Python instance that can't see/find my programs. My first instinct was to write a script that invokes the interpreter from the python scripts directory and I came across this link.

This pointed me to the windows help center's A-Z command reference. (Obvious, but so easy not to know about; its available from the [Start] button or using F1 while the desktop is current).

I wrote the following mighty script, called run_python.

C:\\PROGRA~1\\PYTHON2.5\\python %1

which is located in my python modules directory/folder. This can be run from the command line or explorer to start the interpreter or takes a single file argument from a command line to run a python module. This still isn't what we want, so I found

which pointed out that the PATH variable can be edited using

My Computer - Properties - Advanced - Environment Variables

so this is what I did, which means that is when I [Start] [Run] [command], and then type 'python', the command interpreter starts. This means I can use the command line to run programs, or I can iconise the modules, or create batch files containing the python module invocation. I think my super script above will become redundant, but it proves to me that scripting will never go away and I am gratefull for the help of the two web sites above, which I though I'd share with you.

tags:

Comments:

Post a Comment:
Comments are closed for this entry.
About

DaveLevy

Search

Archives
« July 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
   
       
Today