简体   繁体   中英

Cannot open .py files: “[Errno 2] No such file or directory”

I cannot open any.py file: when I run in the command prompt either "python test.py" or "python3 test.py" or "py test.py", it just says can't open file 'C:\Users\Ciela\Desktop\test.py': [Errno 2] No such file or directory .

  • Python is installed, latest version
  • All other versions are uninstalled
  • Python was automatically added to PATH during installation, I can see it in both User and System paths and the version is correct
  • the files can be opened in Python just by double-clicking them, although they shut off immediately (I know they work because the "turtle module" screen persists on the screen)
  • The OS is Windows 10 and I am a total noob trying to learn

What could it be??

I would try first:

cd C:\Users\Ciela\Desktop\

in command prompt then I would try it again

I sorted it out. For anyone struggling with the same issue, the problem might be OneDrive. Windows10 automatically creates 2 desktops: the one in User, and the one in User/OneDrive, where files are stored by default. Essentially I was looking for the files in the wrong desktop folder.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM