DistutilsOptionError: must supply either home or p

2019-01-10 00:25发布

I've been usually installed python packages through pip.

For Google App Engine, I need to install packages to another target directory.

I've tried:

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?

8条回答
聊天终结者
2楼-- · 2019-01-10 00:48

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:

[install]
prefix=

Edit: Do not use this Homebrew recommended option, it will break normal pip operations.

查看更多
Luminary・发光体
3楼-- · 2019-01-10 00:49

If you're using virtualenv*, it might be a good idea to double check which pip you're using.

If you see something like /usr/local/bin/pip you've broken out of your environment. Reactivating your virtualenv will fix this:

VirtualEnv: $ source bin/activate

VirtualFish: $ vf activate [environ]

*: I use virtualfish, but I assume this tip is relevant to both.

查看更多
登录 后发表回答