Asked By – Arthur Kim
I’ve been usually installed python packages through pip.
For Google App Engine, I need to install packages to another target directory.
pip install -I flask-restful –target ./lib
but it fails with:
must supply either home or prefix/exec-prefix — not both
How can I get this to work?
Now we will see solution for issue: DistutilsOptionError: must supply either home or prefix/exec-prefix — not both
Are you using OS X and Homebrew? The Homebrew python page https://github.com/Homebrew/brew/blob/master/docs/Homebrew-and-Python.md calls out a known issue with pip and a work around.
Worked for me.
You can make this “empty prefix” the default by adding a
~/.pydistutils.cfg file with the following contents:
Edit: The Homebrew page was later changed to recommend passing
--prefix on the command line, as discussed in the comments below. Here is the last version which contained that text. Unfortunately this only works for sdists, not wheels.
The issue was reported to pip, which later fixed it for
--user. That’s probably why the section has now been removed from the Homebrew page. However, the problem still occurs when using
--target as in the question above.