我在一個文本文件「program.py」中寫了程序。我將這個文件保存在桌面上。我想通過命令行來執行此Python命令行
Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. All rights reserved.
C:\Users\x0266161>cd C:\Users\x0266161\Desktop\
C:\Users\x0266161\Desktop>python program.py
hello world
Now is it possible for me to execute the program without changing to the directory where program is stored.
when I try I am getting below error
C:\Users\x0266161\Desktop>cd ..
C:\Users\x0266161>cd ..
C:\Users>cd ..
C:\>python program.py
python: can't open file 'program.py': [Errno 2] No such file or directory
C:\>
我有環境變量設置爲這個路徑C:\用戶\ x0266161 \桌面。