Pip Install Python Packages Offline on Linux – Python Tutorial

By | August 25, 2022

Sometimes, we need install some python packages offline using pip command on linux. How to install? In this tutorial, we discuss this topic.

Download python packages using pip

In order to install python packages offline, we should download them first. In python, we can use pip download command to download.

For example:

pip download -i https://mirrors.aliyun.com/pypi/simple/ tensorboardX --trusted-host mirrors.aliyun.com -d D:\python-packages\tensorflow\tensorboardX

This command will download python tensorboardX pacakge to D:\python-packages\tensorflow\tensorboardX

Install python packages offline using pip

For example, if you have download a python package torchaudio-0.7.2-cp38-cp38-manylinux1_x86_64.whl. You also can install it directly.

Python Install .whl File – Python Tutorial

However, if also may access internet to find dependent packages.

If you have download all dependent python packages, you can use command below to install a python package offline.

pip install --no-index --find-links=/app/jupyter/python-packages torchaudio-0.7.2-cp38-cp38-manylinux1_x86_64.whl

Here /app/jupyter/python-packages is the directory that you save python packages, pip will find all packages that need to install in this directory.

torchaudio-0.7.2-cp38-cp38-manylinux1_x86_64.whl is the package we want to install offline.

Then, you can install your wanted python packages.

Pip Install Python Packages Offline on Linux - Python Tutorial

Leave a Reply