Can pip use existing packages rather than downloading again?
I'm working on a new project that needs a new virtualenv. When I do pip install -r requirements.txt, it downloads the packages all over again even though those packages already exist on the previous project's virtualenv.
Is there any开发者_如何学运维 way to tell pip to get the packages from the other virtualenv instead?
It's not the answer to your question but I guess it's what you want, i.e. avoiding the download: you can specify the environment variable PIP_DOWNLOAD_CACHE=/path/to/directory/where/downloaded/packages/will/be/stored Packages will be downloaded into this directory and if they are to be installed again, taken from this directory.
Got it from: http://tartley.com/?p=1133 and works fine for me
There is also the option --download-cache to the pip install command - I guess it does the same thing, but the environment variable is handier.
Equivalently to the accepted answer, you can use ~/.pip/pip.conf
:
[global]
download-cache=/path/to/some/dir
as found here.
Nope. You can run your own PyPI mirror or caching proxy server, but that's about it.
精彩评论