Setting the default installation location for pip

12,717

A somewhat alternative approach could be virtualenv, like this:

virtualenv path/to/your/storage/venv

then

source path/to/your/storage/venv/bin/activate

This last command transports you to your virtual environment, and while in there, anything installed via pip will get installed in that directory, which can be on other device.
I would prefer this approach, because there's very little manual configuring required, but you would need to install virtualenv (it's about 2MB).

Share:
12,717

Related videos on Youtube

Jules
Author by

Jules

Expert Python programmer with experience working with the Linux network stack, REST APIs, and relational databases (and Postgres in particular). There's some devops experience in there too, but software dev is my preference. Not currently open to new work.

Updated on September 18, 2022

Comments

  • Jules
    Jules over 1 year

    I'm working on a computer with extremely limited internal storage, so I want to set up pip and my Python environment so that new packages are installed to an SD card (which is going to be inside the machine all the time anyway) by default.

    Does pip provide this kind of functionality?

    • magicandre1981
      magicandre1981 over 8 years
      which OS do you use?
    • Jules
      Jules over 8 years
      @magicandre1981 This is on Ubuntu 15.10.