python: can't open file in macbook terminal - [Errno 2]!

久未见 提交于 2021-02-05 10:50:28

问题


In my macbook air terminal I wrote

python eggshell.py

but I got this error

python: can't open file 'eggshell.py': [Errno 2] No such file or directory s-user:/ user$

After I got that error I tried a number of things, like specifying exactly were eggshell.py is:

python Users/myuser/Eggshell/eggshell.py

Doing that just gave me a different Errno 2 error:

OSError: [Errno 2] No such file or directory: 'modules/commands/macOS'

If you have anything that can help me figure this out, I'd be incredibly grateful, thanks. P.S I'll attach an image of where the eggshell.py is located

eggshell.py is actually located in a folder in my documents, but it shows up in the documents too, so I really don't know why python eggshell.py doesn't work.


回答1:


You have to be in the directory the eggshell.py was located. (use cd to navigate)



来源:https://stackoverflow.com/questions/46814874/python-cant-open-file-in-macbook-terminal-errno-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!