Pip Offline Install Packages

Offline install python packages sometimes is very useful, especially when you go down for on-site work and there are no internet environments.

When I install requests package offline, I found that it suck, because it’s need to download some other requirements online.
So, I must download the require package from network everytime when I face the error. I had do the error -> download -> install -> error serval times and lose heart.
Then I try to search from google and found a very useful pip command.

1
2
pip download requests
pip download -r requirements.txt

This command will download all the requirements packages’s wheel file to local folder, and then you can install the packages offline very smoothly.

1
2
3
4
5
6
bash-> pip download requests

bash-> ls

certifi-2018.11.29-py2.py3-none-any.whl idna-2.8-py2.py3-none-any.whl urllib3-1.24.1-py2.py3-none-any.whl
chardet-3.0.4-py2.py3-none-any.whl requests-2.21.0-py2.py3-none-any.whl

Great, that’s so nice tool, I think I need to read the manual before I use a tool……