I working on setting up my environment and am struggling getting a my first ex1.py program to run in power shell. I believe I have Python loaded correctly but it can not find the path when I execute to run the program. I have found a couple of solutions on the net but it has not fixed my problem yet after trying them. Any ideas?
I was recommended by Zed to:
Alright, so look at the top of your editor and what does it say where the file is saved?
c:\User\Brian\OneDrive\Documents\Python Programs\
Now look at your power shell and what does it say about where you are?
C:\Users\Brian
If you do an ls like this:
ls
It will show you that your file isn’t there, because it’s in the place where the editor saved it. Do this:
After running I still have the same issue, PS can’t find the path
I also tried after google searches (both examples):
Hi @Brian1 I’m not on Windows right now, but it seems to me your problem stems from the space in your directory name Python Programs. Try to rename the directory to something like PythonPrograms or Python_Programs and try it again.
So your path should then look something like that:
One way to double check this is open the directory you want in Explorer, then just drag it into the PowerShell window. PowerShell will then write it out correctly for you. Works with files too.
The Tab also auto fills. So from C:\Users\Brian\OneDrive\Documents\ type cd Pyt (TAB) and then '.\Python Programs\' should pop up (or what ever starts with Pyt, then just keep hitting Tab). It turns green i think. I cant tell up my screen right now.
After pressing Enter , you will cd into C:\Users\Brian\OneDrive\Documents\Python Programs\