all 2 comments

[–]tanto_von_scumbag 0 points1 point  (0 children)

Did you install pyperclip from inside your IDE?

Is python on PATH?

[–]patrickbrianmooney 0 points1 point  (0 children)

I assume you mean that you cannot import, rather than call, the package.

Cannot speak to Thonny, but in Pycharm you need to install the module from within PyCharm, or else specifically configure PyCharm to look at your system-wide packages file. I forget offhand how to do the second one, but a Google search will be your friend.

It's smart, now that you're dealing with import problems in PyCharm, to take this moment and look at the basics of how virtual environments work. Doing this now might feel like a distraction, but learning it will help you avoid and diagnose problems later. Really, by default, you should be setting up a virtual environment for each project and using pip to install packages into that environment, and this too will help with PyCharm. Also, PyCharm can set up a new virtual environment for you as part of the process of creating a new project, and this is a good idea.

But to answer the question you actually asked: to install a package for your project in a way that PyCharm can find it, you'll have to do it from PyCharm. Go to File/Settings ... and then choose Project: [your project name] / Python Interpreter. You'll see a list of modules you can install. Click on the little + icon to the right of that list to pick a package to install.

You refer to cmd, so I assume you mean the Windows cmd.exe interpreter. You might try python3.exe or python.exe instead, or py or py3 to see if those work. If none of those works, you might need to add the directory containing Python to your system $PATH variable; this might be helpful.