I am trying to use pyperclip for a python course I am doing and it tells me to import pyperclip, but when I import it VS code says Import "pyperclip" could not be resolved even though I went into the terminal and installed it my python version is 3.10.6 64bit does anyone know how to fix this?
pip install pyperclip
CodePudding user response:
Follow the steps below to choose an interpreter
- Open the command palette with Ctrl Shift P
- Search for Python:Select Interpreter
- Choose the correct interpreter
It is recommended to use a virtual environment
use the following command in the vscode terminal:
Create a virtual environment ( named .venv )
python -m venv .venv
Activate the virtual environment
.venv/Scripts/Activate
Select the interpreter in the virtual environment
Create a new terminal to automatically activate the virtual environment
Install the packages you need to use in the current environment
Virtual environments can help you manage using different python versions and using different packages.