0

I've downloaded python installer from http://www.python.org/ftp/python/3.1.2/ , this python-3.1.2.msi file, I need to execute some python files? How do I do that? For example in php I'd do php filename.php from console, I do however have python command line but I don't know how to execute those files.

So if I could set ENV variable to directly execute my file(s) if that is possible that would be great.

asked Jun 21, 2010 at 13:43

3 Answers 3

2

There is an option in the installer called "Register Extensions" to associate Python files with the interpreter, so double-clicking them or entering filename.py in the console should work.

Apart from that you might want to add C:\Python31 to your PATH variable (right-click on My Computer, choose Settings, choose the Advanced Tab - there you can access the system variables. Better do this as an admin.

answered Jun 21, 2010 at 13:49
Sign up to request clarification or add additional context in comments.

1 Comment

I've added it to the path now, but I get some compile errors is it possible that I've downloaded wrong version of the language?
0

If you type python in the Windows command line, what happens? Is the Python interpreter in your PATH yet?

If not, add the Python installation directory there (here's a good guide). Then just do python script.py just like with PHP.

answered Jun 21, 2010 at 13:46

4 Comments

I've added it to the path now, but I get some compile errors is it possible that I've downloaded wrong version of the language?
Python 3 is incompatible with Python 2. If you're getting runtime errors (hard to get compile errors in Python), you might be running a Python 2 script. A good sign are print statements - if the syntax used is print "Hello" instead of print("Hello"), then it's a Python 2 script. You can have both versions installed in parallel.
@Tim Pietzcker its like this in the file print " list - Print summary of existing objects by class" so its version 2 of the language?
Yes it is. Download version 2.6.5 and install it in a different directory - see also here: stackoverflow.com/questions/1835930
0

you can just execute python yourfile.py

Or if the python command don't work you have to give the absolute path to you python installation or add it to windows path

answered Jun 21, 2010 at 13:46

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.