有解决此问题的解决方案吗?

时间:2020-10-01 11:37:26

标签: python directory

PS C:\Users\Sigde\Desktop\vscodde> python -u "c:\Users\Sigde\Desktop\vscodde\programs\i.py"

Enter a number: 45
Enter a number: 3
Enter a number: 4
Enter a number: done
Maximum is 45.0
Minimum is 3.0
PS C:\Users\Sigde\Desktop\vscodde> python i.py

C:\Users\Sigde\AppData\Local\Programs\Python\Python38-32\python.exe: can't open file 'i.py': [Errno 2] No such file or directory
PS C:\Users\Sigde\Desktop\vscodde> python i.py
C:\Users\Sigde\AppData\Local\Programs\Python\Python38-32\python.exe: can't open file 'i.py': [Errno 2] No such file or directory
PS C:\Users\Sigde\Desktop\vscodde>

我该如何解决?

1 个答案:

答案 0 :(得分:4)

您可以通过为Python文件指定正确的位置来解决该问题。因为,根据您的运行效果,它位于:

c:\Users\Sigde\Desktop\vscodde\programs

,根据Powershell提示,当前目录为:

c:\Users\Sigde\Desktop\vscodde

因此,您将使用:

python programs\i.py