英文:
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
答案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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论