Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I broke my BSD box, and I need to survive a few days in unknown Windows territory. I got the Python interpreter running in a terminal by typing python. I ran notepad with the prompt as well, but I am totally lost after that.

How can I do this?

$ mkdir Test
$ echo "print 'hello'" > test.py
$ python test.py

I would greatly appreciate if someone explained in terms of unix tools how I can get just python and a text-editor running? (I'm missing an environment variable; found C:\Python26\python.exe but haven't yet gotten the env var correct).

share|improve this question
    
I am just looking someone to explain me what this thing is. I do not want spend any time to it, I want some quick way to get unix -style tools working. I am not sure which is the best option. Perhaps some virtualized unix or something like that? I am happy if I get python working because I can handle most stuff with it but I am interested to know how you other folks handle things like this when you MUST just use the shxt? –  user3672 Jul 20 '11 at 22:19
    
Nevermind. Add any specific question to your question and I'll update my answer. My solution is to add GnuWin32, vim, ie. decent tools to the environment. –  Vitor Jul 20 '11 at 22:21
add comment

migrated from unix.stackexchange.com Jul 22 '11 at 15:12

This question came from our site for users of Linux, FreeBSD and other Un*x-like operating systems..

2 Answers

up vote 2 down vote accepted

Your example mkdir Test; echo "print 'hello'" > test.py; python test.py is actually valid in Windows Command Prompt, provided that you have set the Environment Variable as suggested here. You can also set Variables temporarily or list all your current Variables using the set keyword, enter set /? in command prompt for more. (to set it permanantly use the setx utility, download from here).

To list where something is in the path (which work-alike, if you don't use cygwin), use the script I posted here.

For a start, do yourself a favor and download Cygwin plus Cygwin Ports and add the cygwin /bin directory to the Path.

share|improve this answer
    
It apparently creates some sort of virtual directory structure. How can I find the C:\Python26\ there? Where does it place the original structure? –  user3672 Jul 20 '11 at 23:23
1  
@hhh: are you speaking about cygwin?, let's say you installed it as C:\cygwin, the cygwin directory is like /, there is a /cygdrive folder under which the whole file-system is mounted (you got the loop?...). so to access C:\Python26\ you do cd /cygdrive/c/Python26 in cygwin's shell. also take a look at the chere package. –  Philomath Jul 20 '11 at 23:37
add comment

Since you already installed the interpreter try on the prompt:

echo %PATH%

Is python on the PATH? If not, right click on My Computer, then Properties, then Advanced, then Environmental Variables and add it.

Python should comes with IDLE. Can't you find it on the start menu? IDLE has a text editor. You could also download vim or wherever suits your taste.

Also I'd suggest you to download GnuWin32 and add it to the path. This way you get a more familiar environment and less crude tools than wherever comes with Windows.

share|improve this answer
    
how can I find the location of the python installed to this box? Is there something like locate/whereis? –  user3672 Jul 20 '11 at 22:54
    
@hhh Nothing similar to locate as far as I know. Python usually installs itself on the C:` root as C:\Python{version}` (like C:\Python26). Just take a look C:\ using the My Computer icon. Or you can right click on Python icon in the start menu, look at Properties and see where the shortcut points to. –  Vitor Jul 20 '11 at 23:00
    
I found python in C:\Python26\python.exe but I cannot find the executable (the file to add to the env var). –  user3672 Jul 20 '11 at 23:01
    
@hhh Add just C:\Python26 to the %PATH%. You must close the prompt and open another one before changes to %PATH% take effect. –  Vitor Jul 20 '11 at 23:03
    
here I pasted a which work-alike in Windows CMD. HTH. –  Philomath Jul 21 '11 at 0:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.