Open In App

How to Install PyQuery in MacOS?

PyQuery is a Python package. This package provides a jQuery-like API. It makes use of the lxml module to manipulate XML and HTML quickly. The API is as close to jQuery as possible. 

Installing PyQuery on MacOS

Method 1: Using pip to install PyQuery Package



Follow the below steps to install the PyQuery package on macOS using pip:

Step 1: Install the latest version of Python3 in macOS.



Step 2: Check if pip3 and python3 are correctly installed or not by using the following commands:

python3 –version

pip3 –version

Step 3: Upgrade your pip to avoid errors during the installation of the PyQuery package.

pip3 install –upgrade pip

Step 4: Enter the following command to install PyQuery using pip3.

pip3 install pyquery

Method 2: Using setup.py to install PyQuery

Follow the below steps to install the PyQuery package on macOS using the setup.py file:

Step 1: Download the latest source package of PyQuery for Python3 from here.

curl https://files.pythonhosted.org/packages/e9/27/6db65c90587856a229539df703679fa81d17089b74432abfd74a0dd2ca13/pyquery-1.4.3.tar.gz > pyquery.tar.gz

Step 2: Extract the downloaded pyquery package using the following command:

tar -xzvf pyquery.tar.gz

Step 3: Now go to the pyquery-1.4.3 folder and enter the following command to install the package.

cd pyquery-1.4.3

python3 setup.py install

Note: You must have developer tools for XCode MacOS installed in your system

Verifying PyQuery installation on macOS:

To verify PyQuery is installed correctly or not we import the pyquery in the python terminal. It if will give an error then it means PyQuery is not installed properly.

import pyquery

Article Tags :