Python PIP local cache

Datetime:2017-04-20 05:57:33         Topic: Python          Share        Original >>
Here to See The Original Article!!!

PIP is the Python Package Manager that allows Python developers and users to easily install Python packages published on the pip remote register by other developers .

If you are using the pip manager frequently then you may find this quick tip useful ,where I'll show how you can activate or enable the local cache of pip which is going to boost the download speed of pip packages .

The idea behind the pip cache is simple ,when you install a Python package using pip for the first time ,it gets saved on the cache .If you try to download/install the same version of the package on a second time ,pip will just use the local cached copy instead of retrieving it from the remote register .

Enabling the local cache of pip

Enabling the local cache of pip is fairly simple so let's do it step by step .

First open the pip configuration file located at ~/.pip/pip.conf with your preferred text editor .

vim ~/.pip/pip.conf

Then copy and add this

[global]
download-cache=/usr/local/pip/cache

Next create the folder

mkdir -p /usr/local/pip/cache

Then give it write access

chmod -R 755 /usr/local/pip/cache

You can instead use your profile config file ~/.bash_profile

So open ~/.bash_profile .

And add

export PIP_DOWNLOAD_CACHE=$HOME/.pip_download_cache

That is it ! I hope this was helpful for you .








New