How to use Python's pip to download and keep the zipped files for a package?

前端 未结 8 965
暗喜
暗喜 2020-11-28 18:48

If I want to use the pip command to download a package (and its dependencies), but keep all of the zipped files that get downloaded (say, django-social

8条回答
  •  天涯浪人
    2020-11-28 19:33

    I always do this to download the packages:

    pip install --download /path/to/download/to_packagename

    OR

    pip install --download=/path/to/packages/downloaded -r requirements.txt

    And when I want to install all of those libraries I just downloaded, I do this:

    pip install --no-index --find-links="/path/to/downloaded/dependencies" packagename

    OR

    pip install --no-index --find-links="/path/to/downloaded/packages" -r requirements.txt


    Update

    Also, to get all the packages installed on one system, you can export them all to requirement.txt that will be used to intall them on another system, we do this:

    pip freeze > requirement.txt

    Then, the requirement.txt can be used as above for download, or do this to install them from requirement.txt:

    pip install -r requirement.txt

    REFERENCE: pip installer

提交回复
热议问题