Pip install to custom target directory and exclude specific dependencies

前端 未结 3 1927
野的像风
野的像风 2021-02-07 03:12

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

3条回答
  •  忘了有多久
    2021-02-07 03:35

    I think this essentially can be achieved in several steps, assuming you're using virtualenv or similar...

    • If you first do a normal pip freeze > requirements.txt you'll get all of the transitive dependencies (e.g. not excluding anything.)

    • Now edit requirements.txt, remove the packages you want to exclude...

    • Finally, in a new environment do pip install -r requirements.txt -t ... --no-deps. Voila: you've installed the dependencies you wanted while excluding specific ones.

提交回复
热议问题