A note on how to install Python packages on devices that are not connected to the internet.
The list of packages you want to install is organized in requirements.txt
.
I verified it in Windows 10 (x86_64) + Anaconda3 environment, but I feel that it can be done on other platforms as well.
$ pip download --dest=src -r requirements.txt
This online terminal uses the same platform as the offline terminal (installation destination). pip download
has an option called --platform
, so if you specify this well, it may be possible on different platforms, but it has not been verified.
Reference: pip download — pip documentation
If you look in the src
directory, you can see that the package can be downloaded in the form of a wheel or tarball.
It is assumed that the package file downloaded on the online terminal is copied to the offline terminal and placed under the src
directory.
$ pip install --no-index --find-links=src -r requirements.txt
This will try to install the package based on requirements.txt
, but will look for the package in the src
directory instead of from PyPI (Internet).
Recommended Posts