1

Can't seem to get imports to work. I've installed using

pip install pyperclip

I can can confirm that it was successfully installed:

CMD screenshot

But then when attempt to confirm in in the Shell:

IDLE screenshot

Is there another step to importing that I'm just missing?

Aaron
  • 10,133
  • 1
  • 24
  • 40
  • 1
    Can you do `python -c "import pyperclip"` from the command line? – Mad Physicist Feb 21 '17 at 20:02
  • 2
    Also, A) how do you run Python, and B), what is the output of `python --version`? – Mad Physicist Feb 21 '17 at 20:02
  • @MadPhysicist also C) what are the contents of `sys.path` – Aaron Feb 21 '17 at 20:14
  • python --version returns: Python 3.6.0 – Brenden Barker Feb 21 '17 at 20:15
  • I've been running Python from IDLE 3.6 64-bit and CMD. – Brenden Barker Feb 21 '17 at 20:17
  • as an aside, I would just use tk: https://www.daniweb.com/programming/software-development/code/487653/access-the-clipboard-via-tkinter – Aaron Feb 21 '17 at 20:18
  • >>> print(sys.path) ['', 'C:\\Users\\bbarker\\AppData\\Local\\Programs\\Python\\Python36\\Lib\\idlelib', 'C:\\Users\\bbarker\\AppData\\Local\\Programs\\Python\\Python36\\python36.zip', 'C:\\Users\\bbarker\\AppData\\Local\\Programs\\Python\\Python36\\DLLs', 'C:\\Users\\bbarker\\AppData\\Local\\Programs\\Python\\Python36\\lib', 'C:\\Users\\bbarker\\AppData\\Local\\Programs\\Python\\Python36', 'C:\\Users\\bbarker\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages'] – Brenden Barker Feb 21 '17 at 20:22
  • And I have used tkinter, but I'm having the issue where no imports will work, not just pyperclip. When I, python -c "import pyperclip", there is no return message and the shell still does not find the module. – Brenden Barker Feb 21 '17 at 20:28
  • how did you install python? manually? winpython? anaconda? xy? etc.. – Aaron Feb 21 '17 at 20:33
  • The installer download at [python.org](https://www.python.org/downloads/) – Brenden Barker Feb 21 '17 at 20:38

1 Answers1

0

Your problem is that pip is installing for the global (all users) version of python, and you're using a version of python installed for only your user c:\Users\bbarker\AppData\Local\Programs\Python\Python36. You'll want to either use the global install instead c:\program files (x86)\python36-32 or change your pip defaults as described here.

You'll notice the folder where pip told you where pyperclip was installed does not show up in sys.path. Therefore python does not know to search there for libraries. Those few file paths you did have in your sys.path are automatically generated defaults that are relative to the install directory of the particular instance of python you're currently using. If you use the instance in your \program files (x86)\ folder, the paths will be relative to that folder instead

tldr;

You have 2 instances of python installed, and you're installing libraries to one and using the other.

Community
  • 1
  • 1
Aaron
  • 10,133
  • 1
  • 24
  • 40