1

I'm trying to copy some text to clipboad in my python program, so I've installed pyperclip via pip command via Windows command line interface, it says everything is successfully installed, not a problem. However, when I import the thing into my project, I get

from tkinter import *
from tkinter import ttk
import pyperclip
import binascii
#my code...
...

ModuleNotFoundError: No module named 'pyperclip'

So I was like *** that, maybe it's broken, I found a little library that does exactly the same, called "clipboard". Exactly the same installation procedure - from the command line. Same successful installation. Same ModuleNotFoundError. So clearly something wrong on my side, but I have no idea what it is, no idea where to look and what to do. I just want to be able to copy some text to clipboard. Multiplatform. That's it.

It's Python 3.8, Windows 10
pyperclip-1.8.0
pip-20.2.2

If I need to show you some logs or tell you something about my installation, please tell me what exactly to do and where to find information you may need. I'm good with instructions, but I don't have much (any) experience rummaging through logs and python installation folders.

Similar posts have slightly different problems, I didn't find any clear solution or hints that I could understand. No reply seemed like a solution to me.

Anyway, I would really appreciate any help from the community. Being unable to simply copy something to clipboard is killing me, especially since it's the only thing I can't implement. And it's just one function for one button to copy one short piece of text. It's like being stuck at 99% loading, when everything is done, and you just can't write the final line of code, haha.

Ilya
  • 992
  • 7
  • 14
  • 1
    Any IDE is used? – Delrius Euphoria Aug 22 '20 at 11:52
  • PyCharm 2019.1.3 (Professional Edition) Build #PY-191.7479.30, built on May 29, 2019 JRE: 11.0.2+9-b159.60 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 10 10.0 – Ilya Aug 22 '20 at 11:56
  • 2
    Yes i thikn that is the actual problem, using pycharm creates a virtual env and for that you have to install for that virtual env, simply navigate to Pycharm >> File >> Settings(or press Ctrl+Alt+S on win) >> Project:Name >> Project Interpreter >> Click on the plus(+) symbol above the scroll bar and type in pyperclick and and press install package. Let me know if this works – Delrius Euphoria Aug 22 '20 at 12:30
  • @CoolCloud Yes, that worked! Thank you! If you wish, you can give a longer separate reply and I will select it as the correct one! Much appreciated! – Ilya Aug 23 '20 at 08:09

1 Answers1

1

Pycharm uses a virtualenv for pycharm projects. Navigate through:

Pycharm >> File >> Settings(or press Ctrl+Alt+S on win) >> Project:Name >> Project Interpreter >> Click on the plus(+) symbol above the scroll bar and type in pyperclip and press install package.

And this will install pyperclip for your Pycharm IDE. Since pycharm uses a virtual env for its projects you can change it in the project interpreter section as well, and then the pyperclip you installed from the cmd using pip, will be available to be used on that global version of python(now used by your Pycharm too).

If you still have any errors or doubts, do let me know :D

Cheers

Delrius Euphoria
  • 14,910
  • 3
  • 15
  • 46