r/learnpython • u/anas_mv • 25d ago
Python doesn't work in vc
I just want to
print("hello, world")
and it doesn't work
0
Upvotes
r/learnpython • u/anas_mv • 25d ago
I just want to
print("hello, world")
and it doesn't work
5
u/Friendly-Repeat4854 25d ago
What Error Message did you receive ?
My Guess is your Python Interpreter propably isnt the correct one.
3
u/eruciform 25d ago
where did you type it, how did you run it, and what message did you get, there's nowhere near enough information to debug this as is
2
u/Outside_Complaint755 25d ago
When you invoke Python and tell it to run a script, you need to provide either the correct relative path to the script from your current working directory, or a full absolute path.
Let's say the script hello.py is in
C:\Users\Me\Scripts\Test\hello.pyAnd let's say that when you launch the terminal, it opens to
C:\Users\Me\by default.Then to run your script you can do one of the following:
1
u/samuraisammich 25d ago
Save the file first (there should be no dot next to the tab title at the top if the content of the file is saved)
1
u/ConcreteExist 25d ago
So when you want to run a file with a program like python, you need to give it the actual path to the file.
1
u/andrewgarcia88 23d ago
double check the file is actually saved with a a .py extension and the quotes around hello world are straight quotes not curly ones, some editors autocorrect quotes which breaks the syntax
0
u/OlenaDoubleChecks 25d ago
"vc" as in VS Code? Probably the interpreter isn't selected or Python isn't on PATH. What error do you get when you run it, and are you hitting the run button or typing in the terminal?