I am trying this AI assistant Jarvis from a YouTube tutorial and I have to submit it as a final project. In order to start the code, I have to first import pyttsx3 which is a text-to-speech conversion library in Python. When I write 'pip install pyttsx3' in the terminal of VS Code, it returns back pip not defined. Please guide me here I have no other help.

Try using command line:
windows_key + r, and type incmd. Then, 'pip install pyttsx3'.If you don't have pip (it should come with python, assuming you downloaded python from the official website), see this question for reference.