Very basic help needed please - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Very basic help needed please (/thread-1033.html) |
Very basic help needed please - 0621_OWLgale - Nov-28-2016 First time using Python and I bought a book called Python in Easy Steps by Mike McGrath. I have made it onto page 16!! and 'Writing your first program', and my first attempt at this is not working, after creating a hello.py file it says 'to launch command prompt window, navigate to new directory and precisely enter the command python hello.py - to see the Python interpreter run your program', how do you navigate to the directory through the command prompt window? I cannot do this as it does not allow me to go to the directory through the command prompt window and when I enter in the python hello. py, the below is what I get, C:\Users\gg>C:\Python34\MyScripts>python hello.py 'C:\Python34\MyScripts' is not recognized as an internal or external command, operable program or batch file. I will be very grateful if someone can give me advice on how I do this, thanks very much in advance OWL RE: Very basic help needed please - buran - Nov-28-2016 C:\Users\gg> cd C:\Python34\MyScripts C:\Python34\MyScripts>python hello.py OR C:\Users\gg>python C:\Python34\MyScripts\hello.py RE: Very basic help needed please - snippsat - Nov-28-2016 Set up environment Variables Path, Like in video,but also point to script folder(pip placement), so for e.g Python 3.4 you add ;C:\python34\;C:\python34\scripts Restart. Now should python and pip work from anywhere in cmd. Test and upgrade pip. C:\>pip -V pip 9.0.1 from c:\python34\lib\site-packages (python 3.4) C:\>cd python34/scripts C:\Python34\Scripts>pip install --upgrade pip Requirement already up-to-date: pip in c:\python34\lib\site-packages RE: Very basic help needed please - 0621_OWLgale - Nov-28-2016 (Nov-28-2016, 04:50 PM)buran Wrote: C:\Users\gg> cd C:\Python34\MyScripts This is it, Microsoft Windows [Version 10.0.14393] © 2016 Microsoft Corporation. All rights reserved. C:\Users\gg>C:\MyScripts>python hello.py 'C:\MyScripts' is not recognized as an internal or external command, operable program or batch file. C:\Users\gg> (Nov-28-2016, 04:51 PM)snippsat Wrote: Set up environment Variables Path,thanks for the info snippsat, can this also be done on Windows 10? RE: Very basic help needed please - snippsat - Nov-28-2016 Works the same in Windows 10. RE: Very basic help needed please - buran - Nov-28-2016 (Nov-28-2016, 06:39 PM)0621_OWLgale Wrote: C:\Users\gg>C:\MyScripts>python hello.py Obviously that's NOT what I suggested... RE: Very basic help needed please - 0621_OWLgale - Nov-28-2016 (Nov-28-2016, 07:00 PM)snippsat Wrote: Works the same in Windows 10. thanks snippsat, I will give it a go (Nov-28-2016, 07:22 PM)buran Wrote:Earlier I tried both Python34\MyScripts>python hello.py , and Python34\MyScripts\python hello.py(Nov-28-2016, 06:39 PM)0621_OWLgale Wrote: C:\Users\gg>C:\MyScripts>python hello.py and both came up with nothing new, but now I have tried again with Python34\MyScripts\hello.py and it works, thanks very much buran, it says in my book to put the word 'python' before 'hello', is that not right? Also can I please ask you another newbie question, what is the difference between opening up a command prompt window and going through the Start list and clicking Python 3.4 (command line)? Both are similar, but the command prompt window always has C:\Users\gg> before you can type anything in and the Python 3.4 (command line) has >>> Many thanks for your time RE: Very basic help needed please - nilamo - Nov-30-2016 If you're in the command prompt and just type "python", without a filename, that's what you'll get. It's called the interpreter, or REPL (read eval print loop). It's used mainly for testing short pieces of code, otherwise you should use files and run them. |