在其他目录中安装pip软件包不起作用 [英] Installing pip packages in different directory does not work
本文介绍了在其他目录中安装pip软件包不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将pip软件包安装到其他目录中,但pip拒绝这样做.
I want to install a pip package into a different directory, but pip refuses to do so.
$ pip install django -t output
File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py", line 264, in finalize_options
"must supply either home or prefix/exec-prefix -- not both"
DistutilsOptionError: must supply either home or prefix/exec-prefix -- not both
推荐答案
Update: When I wrote this answer pipenv was not available. If you having the same problem, I strongly recommend considering using it.
如果使用brew
安装了Python,则需要添加setup.cfg文件(
If you have installed Python using brew
you need to add a setup.cfg file (source) in your project-dir with the following content:
[install]
prefix=
这将解决问题.另外,您可以使用virtualenv
甚至更好的docker.
That will resolve the problem. Alternatively, you can use virtualenv
or even better docker.
这篇关于在其他目录中安装pip软件包不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文