DistutilsOptionError: 必须提供 home 或 prefix/exec-prefix -- 不能同时提供 [英] DistutilsOptionError: must supply either home or prefix/exec-prefix -- not both

查看:25
本文介绍了DistutilsOptionError: 必须提供 home 或 prefix/exec-prefix -- 不能同时提供的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常通过pip安装python包.

I've been usually installed python packages through pip.

对于 Google App Engine,我需要将软件包安装到另一个目标目录.

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

我试过了:

pip install -I flask-restful --target ./lib

pip install -I flask-restful --target ./lib

但它失败了:

必须提供 home 或 prefix/exec-prefix -- 不能同时提供

must supply either home or prefix/exec-prefix -- not both

我怎样才能让它发挥作用?

How can I get this to work?

推荐答案

您使用 OS X 和 Homebrew 吗?Homebrew python 页面 https://github.com/Homebrew/brew/blob/master/docs/Homebrew-and-Python.md 指出了 pip 的已知问题和解决方法.

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.

为我工作.

您可以将此空前缀"设置为默认添加一个~/.pydistutils.cfg 文件,内容如下:

You can make this "empty prefix" the default by adding a ~/.pydistutils.cfg file with the following contents:

[install]
prefix=

Homebrew 页面后来更改为建议在命令行上传递 --prefix,如下面的评论中所述.这里是包含该文本的最后一个版本.不幸的是,这只适用于 sdists,而不适用于轮子.

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.

该问题是报告给 pip,后来 修复了--user.这可能是为什么的部分现在已经从家酿页面删除.但是,在使用--target时,问题仍然存在如上面的问题.

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.

这篇关于DistutilsOptionError: 必须提供 home 或 prefix/exec-prefix -- 不能同时提供的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆