hello.py
is my first python program. It is saved on my desktop.
In the terminal I write in front of
user@AA-MacBook-Air ~ % python3 hello.py
The error is
can't open file 'hello.py': [Errno 2] No such file or directory
Kindly help me understand the problem and solve it.
you first need to change destination with cd
The error message, No such file or directory
pretty much gives the explanation. Check if the file hello.py
is present in the correct working directory. This can done graphically or using the ls
command. If it is not present, copy the file the to the directory or navigate to the location of the file hello.py
in terminal using cd
.
In the terminal you are currently in the directory ~
. This signifies the folder /Users/<username>
. Your script is on your desktop.
Type cd Desktop
to change to /Users/<username>/Desktop
and then run python3 hello.py
.
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.