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

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

    installing python packages offline

    For windows users:

    To download into a file open your cmd and folow this:

    cd <*the file-path where you want to save it*>

    pip download <*package name*>

    the package and the dependencies will be downloaded in the current working directory.

    To install from the current working directory:

    set your folder where you downloaded as the cwd then follow these:

    pip install <*the package name which is downloded as .whl*> --no-index --find-links <*the file locaation where the files are downloaded*>

    this will search for dependencies in that location.

    0 讨论(0)
  • 2020-11-28 19:44

    pip wheel is another option you should consider:

    pip wheel mypackage -w .\outputdir
    

    It will download packages and their dependencies to a directory (current working directory by default), but it performs the additional step of converting any source packages to wheels.

    It conveniently supports requirements files:

    pip wheel -r requirements.txt -w .\outputdir
    

    Add the --no-deps argument if you only want the specifically requested packages:

    pip wheel mypackage -w .\outputdir --no-deps
    
    0 讨论(0)
提交回复
热议问题