I am using Zed Shaw's "Learn Python the Hard Way" and have gotten Python to work. I made a file and saved it as ex1.py. I type the command
python ex1.py
This does not recognize the file like it should and instead gives me this
can't open file 'ex1.py': [Errno 2] No such file or directory
I have checked and double-checked it. There is definitely a ex1.py file saved in my Local Disk (C:). None of the common errors on his tutorial include mine. Any tips?
You need to explicitly indicate that the file is in the current working directory.
Try this:
python ./ex1.py
I got it to work finally, I had it in a folder under the path
C:\\Users\\MyUser\\PythonTest\\ex1.py
This was wrong, however when I made it
C:\\Users\\MyUser\\ex1.py
It worked, thanks for all the help!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.