Run Python on Windows: A Beginner's Guide

  • Context: Python 
  • Thread starter Thread starter MaxManus
  • Start date Start date
  • Tags Tags
    Python Windows
Click For Summary

Discussion Overview

The discussion focuses on how to use Python on Windows, particularly for beginners who may have experience with Linux but are unfamiliar with the Windows environment. Participants share their experiences and troubleshooting steps related to running Python scripts and configuring the system environment.

Discussion Character

  • Technical explanation
  • Homework-related

Main Points Raised

  • One participant inquires about using Python on Windows, expressing confusion due to prior experience only on Linux.
  • Another participant suggests downloading a Windows installer from the official Python website as a potential solution.
  • A participant reports an error when attempting to run a Python script in the Windows terminal, indicating a lack of familiarity with the terminal and the error message's meaning.
  • One participant advises adding the directory containing python.exe to the system path to resolve execution issues.
  • A later reply details the steps taken to edit environment variables, including backing up the path and ensuring the correct syntax for adding Python to the path.
  • Another participant expresses confusion about the environment variable setup and reports continuing to encounter the same error despite attempts to configure it correctly.
  • A participant provides additional guidance on editing the path variable, emphasizing the importance of appending the new entry correctly.
  • A final reply expresses gratitude for the assistance provided in the thread.

Areas of Agreement / Disagreement

Participants do not appear to reach a consensus on the specific steps needed to resolve the issues, as some express confusion and continue to experience errors despite following suggested instructions.

Contextual Notes

Limitations include potential misunderstandings of error messages, variations in system configurations, and the need for clarity in the instructions provided for editing environment variables.

MaxManus
Messages
268
Reaction score
1
How do you use Python on Windows? I have Python 2.5.1, but have only tried Python on the school's computers where they use Linux.
 
Technology news on Phys.org
Hi MaxManus,

MaxManus said:
How do you use Python on Windows? I have Python 2.5.1, but have only tried Python on the school's computers where they use Linux.

If you go to

http://www.python.org/download/

you can find a windows installer. Is that what you are looking for?
 
I'm not sure, but I think I have the right programms, but when I write kick.py in the Windows terminal I get an error message. The message is in Norwegian, but it is something like D:\Documents and Settings\My Name\kick.py is not a valid* Win 32-program. I have never tried to run programs on a Windows terminal and have only tried it a couple of times on the school's computers so I don't know how to interpret the message

* not sure about the translation
 
You must put the directory with python.exe (usually c:\python25) in the path.
Go to control panel->system->advanced->edit environment variables and add it to the end of the path entry.

You can then run a file by typing "kick.py" or "python kick.py"
You can also double click on a .py in explorer and it will start python
 
I'm not sure I understand. I went to edit edit environment variables and added Name: "Python" Value: "D:\Conduit Root\python\python-2.5.1\python.exe", but I stil get the same error
 
Last edited:
MaxManus said:
I'm not sure I understand. I went to edit edit environment variables and added Name: "Python" Value: "D:\Conduit Root\python\python-2.5.1\python.exe", but I stil get the same error

I'll tell you the details of how I got I got it working on my system. (If you're not familiar with this, perhaps you want to make a copy of your path before you add to it? Open a command prompt and then type in
Code:
path >> pathbackup.txt
which will put a copy of your path in a text file in your current directory.)




Anyways, what I did was go to:

control panel -> system -> advanced -> environment variables

On the window that comes up, there will be two sections: one for "User variables for <name>" (where <name> is the login name) and one for "System variables".

In the "system variables" window, scroll down until you see "path" under the variable heading. Highlight that line and then press edit.

In the next popup window, I edited "Variable value". Make sure you are at the end of that line (you are just adding to the line, not changing anything that's already there and it can be a long line) and then I typed in exactly


Code:
;c:\Python25

The semicolon separates entries in the path, and on my system python.exepython is located in c:\Python25. Then you can press OK three times.


After that has all closed, open an command prompt window. You can type "path" to see what your path currently is, and at that point I can type "python" to start python, or "kick.py" to start a file.
 
Thank you
 

Similar threads

Replies
3
Views
3K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 10 ·
Replies
10
Views
4K
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K