Python Forum

Full Version: PIP file location
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone,
I am 64 years old and completely new to programming. I bought a Python book from No Starch Press (Automate The Boring Stuff With Python) by Al Sweigart to get started. It's a great book, and I'm really enjoying it thus far. Unfortunately, I've come to a halt because I can not find the third-party script called pyperclip.py. I followed the directions for using pip in the appendix, and the file seems to have been downloaded properly, but I can't find it. Furthermore, I'm not sure where it should reside in order to import the module into my code.
Thank you in advance for your help.
(Dec-01-2024, 11:47 AM)JackG29 Wrote: [ -> ]I've come to a halt because I can not find the third-party script called pyperclip.py. I followed the directions for using pip in the appendix, and the file seems to have been downloaded properly, but I can't find it. Furthermore, I'm not sure where it should reside in order to import the module into my code.
You only need to import pyperclip there is almost never need to go into your_python..\site-packages to look at files that pip install.
Here how to use it.
# Install
G:\div_code
λ pip install pyperclip --upgrade
Requirement already satisfied: pyperclip in c:\python312\lib\site-packages (1.9.0)
# Use it
G:\div_code
λ python
Python 3.12.2 (tags/v3.12.2:6abddd9, Feb  6 2024, 21:26:36) [MSC v.1937 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyperclip
>>>
>>> pyperclip.copy('Python') # Can now eg open notepad and paste into it
>>> pyperclip.paste()
'Python'

# To get file placement as mention not needed to work with it
>>> pyperclip.__file__
'C:\\python312\\Lib\\site-packages\\pyperclip\\__init__.py'
So now everywhere eg in a Editor/Ide import pyperclip will work as long as you point to use the version of Python that pip has installed to.