

Python is a very powerful language for machine learning as it has many libraries that can be used to help you develop great models for prediction. I will also show how to install libraries in the command prompt (CMD). In this case, python will refer to your venv's interpreter and you should have no further issues.Įven with a venv, in some cases it can end up without pip in some cases, so python and pip will refer to two separate environments causing lots of headache, this is just one of the reasons I suggest using python -m pip.This tutorial explains how to install Python and libraries with Visual Studio. If you selected a venv as your interpreter, VSC will activate it when you open a terminal and you should see (venv) before your prompt like (venv) ~/project $. VSC doesn't symlink or influence the python command in any way, it just selects the interpreter the editor uses when you click the "run" button, so you need to make sure you're using the correct interpreter yourself when installing packages. In VSC, make sure you have the correct interpreter selected, whether that's global or a venv (highly recommended to use a venv to not interfere with system python packages).

In addition, always know what interpreter python/ python3 refers to, you can use the which command like which python3 to see where it is and if it's where you expect.

I personally recommend you never use pip directly, always python -m pip, even in a venv. This is slightly more of an issue on Windows, but applies to any OS. The problem here is you're installing to one python environment, whatever pip and pip3 refer to, but not to the environment you might expect. I also tried to change the version of the Python extension but no with no result. Also tried reloading the window by pressing Command + Shift + P "Developer: Reload Window". But again, when I try to run it on VS I get always the error.

Created a virtual environment and tried it on the terminal from VS "python3 main.py" and it works fine. Looked at the version I'm using, and choose that version on VS "Python: Select Interpreter". Installed with "pip3 install openai" also "pip install openai". python -u "/home/zaesar/Escritorio/coding/python/openAi/main.py"įile "/home/zaesar/Escritorio/coding/python/openAi/main.py", line 1, in When I try to run it I get the following error: Response = (engine="text-davinci-001", prompt=prompt, max_tokens=6) Openai.api_key = API_KEYprompt = "Say this is a test" I'm trying to run a pretty simple Python file: I feel dumb asking this question but I've read everywhere and tried many different things and haven't come to a solution.
