Home > database >  ModuleNotFoundError: No module named 'pyperclip' in Visual Studio Code
ModuleNotFoundError: No module named 'pyperclip' in Visual Studio Code

Time:11-24

I've installed pyperclip and it works fine in python IDLE yet when I try to open the same program in vscode I get : ModuleNotFoundError: No module named 'pyperclip'. I'm on Python 3.10.0 and pyperclip is version 1.8.2

This is the program that I'm trying to run.

import pyperclip

print(pyperclip.paste())

CodePudding user response:

You might be using a different Python Interpreter in VSCode. "pip install" will add to a global Python Interpreter, but you may not have that one selected in VScode. Try opening the Command Palette (Ctrl Shift P) in VScode, start typing the Python: Select Interpreter command, select the command and then check which interpreter VScode is using.

CodePudding user response:

Check which python you are using in the IDLE:

enter image description here

And which python you are using in the VSCode:

enter image description here

If they are different, you can click the bottom-left to select the python interpreter:

enter image description here

Or you can install the package again in the environment which you have selected in the VSCode:

  • Related