I believe there is a simpler solution to this problem (Homebrew's Python on macOS) that won't break your normal pip operations.
All you have to do is to create a setup.cfg
file at the root directory of your project, usually where your main __init__.py
or executable py file is. So if the root folder of your project is: /path/to/my/project/
, create a setup.cfg
file in there and put the magic words inside:
[install]
prefix=
OK, now you sould be able to run pip's commands for that folder:
pip install package -t /path/to/my/project/
This command will run gracefully for that folder only. Just copy setup.cfg
to whatever other projects you might have. No need to write a .pydistutils.cfg
on your home directory.
After you are done installing the modules, you may remove setup.cfg
.