[Python] Pip install to custom target directory and exclude specific dependencies

Discussão em 'Python' iniciado por Stack, Março 2, 2025.

  1. Stack

    Stack Membro Participativo

    I'm looking for a method to use pip or similiar to install a list of python packages to a custom target directory (ex./mypath/python/pkgs/ ), but also exclude/blacklist specific dependencies.

    I want to exclude specific dependencies since they are already met from a different install path (e.g. an anaconda install). I don't have the privilege of adding packages to the default python installation (nor do I want to).

    I'm currently use the -r and -t options of pip. But have not found a way to exclude specific packages.

    A pip command like this is would be ideal:

    pip install --log pip.log -r req.txt -t /mypath/pypkgs/ --exclude exclude.txt


    --no-deps is not an option since I need some of the dependencies.

    I'm currently pursuing a python script to do pip installs that include dependencies I don't need via:

    pip install --log pip.log -r req.txt -t /mypath/python/pkgs/


    and then (automatically) remove the unneeded dependencies after the pip install finishes.

    I hoping some combination of pip commands can achieve what I'm looking for some straightforward away. I'm using pip 7.1.2. Thanks!

    Similar, yet I'm not upgrading and want to specify a target path:

    pip: upgrade package without upgrading particular dependency

    Continue reading...

Compartilhe esta Página