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

前端 未结 8 966
暗喜
暗喜 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:30

    In version 7.1.2 pip downloads the wheel of a package (if available) with the following:

    pip install package -d /path/to/downloaded/file
    

    The following downloads a source distribution:

    pip install package -d /path/to/downloaded/file --no-binary :all:
    

    These download the dependencies as well, if pip is aware of them (e.g., if pip show package lists them).


    Update

    As noted by Anton Khodak, pip download command is preferred since version 8. In the above examples this means that /path/to/downloaded/file needs to be given with option -d, so replacing install with download works.

提交回复
热议问题