Pruthvi Amin
Pruthvi Amin

Reputation: 85

Why am i getting a ModuleNotFoundError: No module named 'pyperclip'?

I'm new to python, so apologies in advance if I’m being stupid.

I'm having trouble importing the pyperclip module to my script. The following error pops up when i type in import pyperclip.

runfile('C:/Users/Pruthvi/Practice.py', wdir='C:/Users/Pruthvi')
Traceback (most recent call last):

  File "C:\Users\Pruthvi\Practice.py", line 1, in <module>
    import pyperclip

ModuleNotFoundError: No module named 'pyperclip'

Having followed the steps in automate the boring stuff with python, I’ve successfully installed the module using pip install pyperclip and it was saved to the c:\users\pruthvi\appdata\local\programs\python\python38-32\lib\site-packages directory by default.

Is this the right folder to save third-party modules and to import them after? Or is there some other reason why I can't import it?

Many thanks, Pruthvi

Upvotes: 0

Views: 3561

Answers (2)

barny
barny

Reputation: 1

On LINUX, I tried to use:

pip3 install pyperclip

and then it works for me.

I didn't have a technical answer for that, but it is related to python3 compatibility of the module

Upvotes: 0

Pruthvi Amin
Pruthvi Amin

Reputation: 85

I found the solution.

The problem was that my IDE (Spyder) was searching in the wrong folder for downloaded modules. All modules downloaded using pip get downloaded to the c:\users\USERNAME\appdata\local\programs\python\python38-32\lib\site-packages directory by default. So I simply set my PATH (where the interpreter searches for files) to this directory.

Corey Schafer has a great video on how to set a PATH: https://www.youtube.com/watch?v=OdIHeg4jj2c

Upvotes: 0

Related Questions