尝试从VSCode而不是终端运行,因为按下按钮比进入终端要容易得多。

huangapple go评论69阅读模式
英文:

Trying to run from VSCode instead of the Terminal since Pressing a button is way easier then going into to the terminal

问题

I just got a new Macbook Pro and I wanted to see running code from VScode works. So I created a simple hello world in python and I keep getting an errror. I have anaconda downloaded and I am using the base conda Interpreter. This is the error I keep getting but say if ran the code through the terninal python3 helloworld.py, it would work. I just wnat to press the run button in the top hand corner. I tried using different interpeters that VScode provided but it did not work. For example if I were to use the python 3.9.6 64-bit interpreter it would give me a different error messssage. Mostly the same but a little different. /Library/Developer/CommandLineTools/usr/bin/python3 is the part thats different and I dont understand why. The goal is to get the programming running from pushing the button in the top right corner. Any help would be greatly appreciated. another thing I am new to programming.

英文:

I just got a new Macbook Pro and I wanted to see running code from VScode works. So I created a simple hello world in python and I keep getting an errror. I have anaconda downloaded and I am using the base conda Interpreter. Shows the kind of error I have.

'''
/Users/joshuadeville/anaconda3/bin/python "/Users/joshuadeville/DevFold
er/print("hello world").py"
/Users/joshuadeville/anaconda3/bin/python: can't open file '/Users/joshuadeville/DevFolder/print(hello': [Errno 2] No such file or directory
'''

This is the error I keep getting but say if ran the code through the terninal python3 helloworld.py, it would work. I just wnat to press the run button in the top hand corner

I tried using different interpeters that VScode provided but it did not work. For example if I were to use the python 3.9.6 64-bit interpreter it would give me a different error messssage. Mostly the same but a little different.

 /usr/bin/python3 "/Users/joshuadeville/DevFolder/print("hello world").py"
/Library/Developer/CommandLineTools/usr/bin/python3: can't open file '/Users/joshuadeville/DevFolder/print(hello': [Errno 2] No such file or directory

/Library/Developer/CommandLineTools/usr/bin/python3 is the part thats different and I dont understand why. The goal is to get the programming running from pushing the button in the top right corner. Any help would be greatly appreciated. another thing I am new to programming

Error message of the trying a different interpreter

答案1

得分: 0

请将您的文件从 print("hello world").py 重命名为 print_hello_world.py,然后尝试再次执行。
由于文件名中不接受引号( ""),因此会出现错误。

英文:

Kindly rename your file from print("hello world").py to print_hello_world.py and then try to execute again.
It does not accept inverted commas( "" ) in the filename, thus getting error.

huangapple
  • 本文由 发表于 2023年7月4日 23:52:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/76614247.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定