How to Install pyperclip in Python on MacOS?
In this article, we will learn how to install pyperclip in Python on MacOS.
Pyperclip is a cross-platform Python module for copy and paste clipboard functions. It works with both Python 2 and 3. This module was created to enable cross-platform copy-pasting in Python which was earlier absent. The pyperclip module has copy() and paste() functions that can send a text to and receive a text from your computer’s clipboard.
Installing pyperclip on MacOS:
Method 1: Using pip to install pyperclip Package
Follow the below steps to install the pyperclip package on macOS using pip:
Step 2: Check if pip3 and python3 are correctly installed.
python3 --version pip3 --version
Step 3: Upgrade your pip to avoid errors during installation.
pip3 install --upgrade pip
Step 4: Enter the following command to install pyperclip using pip3.
pip3 install pyperclip
Method 2: Using setup.py to install pyperclip
Follow the below steps to install the pyperclip pyperclip on macOS using the setup.py file:
Step 1: Download the latest source package of pyperclip for python3 from here.
curl https://files.pythonhosted.org/packages/a7/2c/4c64579f847bd5d539803c8b909e54ba087a79d01bb3aba433a95879a6c5/pyperclip-1.8.2.tar.gz > pyperclip.tar.gz
Step 2: Extract the downloaded package using the following command.
tar -xzvf pyperclip.tar.gz
Step 3: Go inside the folder and Enter the following command to install the package.
Note: You must have developer tools for XCode MacOS installed in your system
cd pyperclip-1.8.2 python3 setup.py install
Verifying pyperclip installation on macOS:
Make the following import in your python terminal to verify if the installation has been done properly:
If there is any error while importing the module then is not installed properly.