Question:
Python Newbie Question?
Coolest Kid on earth
2011-06-19 17:26:29 UTC
I recently switched from years of java coding to python, and I am having difficulty running programs in command prompt. I set the PATH variable in system variables to include C:\Python27, and the ">>>" sign comes up when i just type "python" into the command prompt. However, even though the directory is set and I am saving all the new programs into C:\Python27, it is still giving me an error when I type in "python programexample.py" into the command line or the command line given with ">>>". If anyone could give me tips as to what to do in this situation, like what to change or where to save my programs, that would be amazing
Three answers:
?
2011-06-22 18:27:31 UTC
tan is right, you can do that.



But if you really do want to see it on a command interface, before you type down 'python' on the Command prompt, type down:



cd C:\Python26



Which means change directory, so it will be calling from the environment you want (OR what ever I meant to say)
?
2011-06-20 00:43:02 UTC
http://docs.python.org/faq/windows.html is the official python website, and this site (I think) has exactly what you need. I could type it out here, but I think if just click to their site and type the below into Mozilla/IE's "Find" it would be easier for you to find the solution:



If the python command, instead of displaying the interpreter prompt >>>, gives you a message like:



Hope that helps!
?
2011-06-20 00:55:48 UTC
Hi,



you just need to double-click on your programexample.py to run the python script.



However, I suggest you use an IDLE such as pyscripter.

If you want additional practice, you can go to http://pyschools.com


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...