Beginner here. I’ve just learned the basics of python using VS. I don’t know why I get a syntax error in the VSCode text file but not on the terminal for the command.
Any assistance helping me understand would be great, thank you.
Obviously, this does not conform to python syntax.
Usually we call it a command line.
We run it in the shell instead of python file.
Python files will be compiled and then run. This command line statement will not be compiled (As the wavy line in the file reminds, this is an error code). You can further learn Python syntax to learn more about this problem.
2
Answers
You cannot run shell commands from a python script.
This is the right way to do it. You can also use the subprocess module to do it.
Although, it’s not recommended installing packages inside your code.
You can use a requirements.txt file. Then you just need to run this command once in your terminal:
Obviously, this does not conform to python syntax.
Usually we call it a command line.
We run it in the shell instead of python file.
Python files will be compiled and then run. This command line statement will not be compiled (As the wavy line in the file reminds, this is an error code). You can further learn Python syntax to learn more about this problem.