How to properly install a module in python?

I 'm new to python, and I need some help. At first i install pyperclip using command window: "pip3 install pyperclip". The command window responsed that I have downloaded the module successfully. However I can not use pyperclip in my code. When I coded "import pyperclip", there was an error: "No module name pyperclip..." I then changed the directory of the command window direct to the address of Python, but nothing seem to work. I use PyCharm for my coding. Hope you can hep me solve this problem. Python responsed "No module name pyperclip..."

It clearly that I have download the module.

Upvotes: 0

Views: 142

Answers (2)

Lock-not-gimbal
Lock-not-gimbal

Reputation: 309

The problem is that you have installed the package for another interpreter, one that is not used by your current project. How to install modules for a particular interpreter in PyCharm: https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html

You can also select the interpreter for the particular configuration (setup used for running a script): https://www.jetbrains.com/help/pycharm/creating-and-editing-run-debug-configurations.html

Upvotes: 0

iCarrot
iCarrot

Reputation: 41

Find path to python which you are using and then do something like:

path/to/python -m pip install pyperclip

Or better use conda or pipenv

Upvotes: 1

Related Questions