W
W
Woshibai12022-02-24 12:26:12
Python
Woshibai1, 2022-02-24 12:26:12

Import requests work in IDLE but not in vscode. How to fix?

Installed python 3.10.2 via homebrew. In vscode, the python 3.10.2 interpreter is selected, but when trying to import, it gives the message: "ImportError: No module named requests". How can I get requests imported into vscode?
NFp0m.jpg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AVKor, 2022-02-24
@AVKor

The correct way to do this is to create a virtual environment, in the terminal cdto the project directory (with a virtual environment), then execute the command code .(at the end - a dot separated by a space).

R
Rag'n' Code Man, 2022-02-24
@iDmitriyWinX

Perhaps you have several versions of Python installed and you need to select the desired interpreter in VSCode

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question