Python Packages Offline Installation
I have some virtual machines for testing, but these machines are offline and cannot connect to the Internet. I was having trouble installing the Python module. I can use whl file to install the package, but the package dependencies cannot be installed. This has bothered me for a long time, and now I can finally install the package and its dependencies offline. The following is offline installation method.
First, install all packages and dependencies on the local machine (which has internet). Then back up all the packages and dependencies.
# Confirm the installed package c:\tmp>pip list # Generate requirements.txt c:\tmp>pip freeze > requirements.txt # Create a new folder c:\tmp>mkdir packs # Backup c:\tmp>pip download -d C:/tmp/packs -r requirements.txt
Copy the requirements.txt and packs folder to offline machine.
# Install backed up packages and dependencies c:\tmp>pip install --no-index --find-links=C:\tmp\packs\ -r requirements.txt # Confirm the installed list c:\tmp>pip list