Categories
Python Answers

How to install packages offline with Python?

Spread the love

Sometimes, we want to install packages offline with Python

In this article, we’ll look at how to install packages offline with Python.

How to install packages offline with Python?

To install packages offline with Python, we can download the packages on the computer that has Internet.

And then we can use pip install to install the packages offline.

For instance, we run

pip download -r requirements.txt

on the computer that has access to internet.

Then on the computer that has no access to internet, we run

pip install --no-index --find-links /path/to/download/dir/ -r requirements.txt

to install the packages from the dierctory specified after --find-links.

Conclusion

To install packages offline with Python, we can download the packages on the computer that has Internet.

And then we can use pip install to install the packages offline.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *