skip to Main Content

I’ve installed pip in Debian Linux (I’m using an ARM Chromebook with the Linux beta)

sudo apt-get install python3-pip

which returns:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-pip is already the newest version (18.1-5).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

However in IDLE if I try to import pyperclip, I get:

>>> import pyperclip

Traceback (most recent call last):

  File "<pyshell#23>", line 1, in <module>

    import pyperclip

ModuleNotFoundError: No module named 'pyperclip'

Any idea what’s going wrong here or how I can investigate?

If I run sys.path in my IDLE Python Shell and in the command line I seem to get the same results:

IDLE:
[”, ‘/home/test’, ‘/usr/bin’, ‘/usr/lib/python37.zip’, ‘/usr/lib/python3.7’, ‘/usr/lib/python3.7/lib-dynload’, ‘/usr/local/lib/python3.7/dist-packages’, ‘/usr/lib/python3/dist-packages’]

Command Line:
test@penguin:~$ python3
Python 3.7.3 (default, Dec 20 2019, 18:57:59)
[GCC 8.3.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import sys
sys.path
[”, ‘/usr/lib/python37.zip’, ‘/usr/lib/python3.7’, ‘/usr/lib/python3.7/lib-dynload’, ‘/usr/local/lib/python3.7/dist-packages’, ‘/usr/lib/python3/dist-packages’]

2

Answers


  1. please check which version of Python are you launching with IDLE.
    alternatively you can check by launching python3 and then trying import pyperclip. If you receive no error there you should see how to launch IDLE for Python3.
    I run Xubuntu and by me in the menu I have 2 IDLE entries: one for the default python and one running on python3.7… I always have to be careful which version I am launching…

    Login or Signup to reply.
  2. Well you have to install pyperclip before you can use it, because it is not part of the python3-pip package. pip is an installer which allows you to install python packages like pyperclip.

    sudo pip3 install pyperclip
    

    After the successful installation you can use it with python:

    In [1]: import pyperclip
    
    In [2]: pyperclip.__path__
    Out[2]: ['/usr/local/lib/python3.7/dist-packages/pyperclip']
    
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search